Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask Testing Hangs on self.client.post #151

Open
0mars opened this issue Nov 25, 2020 · 0 comments
Open

Flask Testing Hangs on self.client.post #151

0mars opened this issue Nov 25, 2020 · 0 comments

Comments

@0mars
Copy link

0mars commented Nov 25, 2020

time STAGE=test APP_SETTINGS="authentek.server.config.TestingConfig" pytest authentek/tests/test_auth.py -k 'test_registration'
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.7, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /usr/src/app, configfile: setup.cfg
plugins: factoryboy-2.0.3, Faker-4.17.1
collected 9 items / 8 deselected / 1 selected 


authentek/tests/test_auth.py
    def register_user(self, username, email, password):
        return self.client.post(
            '/v1/users/',
            data=json.dumps(dict(
                email=email,
                password=password,
                username=username
            )),
            content_type='application/json',
        )
    def test_registration(self):
        with self.client:
            response = self.register_user('joe_{}'.format(self.get_timestamp()),
                                          'joe_{}@gmail.com'.format(self.get_timestamp()), '123456')
            data = json.loads(response.data.decode())
            self.assertTrue(data['status'] == 'success')
            self.assertTrue(data['message'] == 'Successfully registered.')
            self.assertTrue(data['auth_token'])
            self.assertTrue(response.content_type == 'application/json')
            self.assertEqual(response.status_code, 201)

Note this is an open source project @ https://github.com/eshta/authentek

reproduce:

docker-compose up -d
make bash auth
make test
@0mars 0mars changed the title Flask Testing Hangs on client.post Flask Testing Hangs on self.client.post Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant