Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

test api register user

    def test_api_register_user(self):
        response = self.client.post('/api/users', json={
            'username': 'bob',
            'email': 'bob@example.com',
            'password': 'bar'
        })
        assert response.status_code == 201

        # make sure the user is in the database
        user = User.query.filter_by(username='bob').first()
        assert user is not None
        assert user.email == 'bob@example.com'
Source by blog.miguelgrinberg.com #
 
PREVIOUS NEXT
Tagged: #test #api #register #user
ADD COMMENT
Topic
Name
5+3 =