test api register user

Solutions on MaxInterview for test api register user by the best coders in the world

showing results for - "test api register user"
Nicolò
23 Jul 2020
1    def test_api_register_user(self):
2        response = self.client.post('/api/users', json={
3            'username': 'bob',
4            'email': 'bob@example.com',
5            'password': 'bar'
6        })
7        assert response.status_code == 201
8
9        # make sure the user is in the database
10        user = User.query.filter_by(username='bob').first()
11        assert user is not None
12        assert user.email == 'bob@example.com'
similar questions
queries leading to this page
test api register user