Example #1
0
 def test_register_user_twice(self):
     """Test if registering the same user twice returns an error"""
     user = User(name='joe', email='*****@*****.**',
                 password='******')
     user.save()
     response = base.base_registration(self)
     data = json.loads(response.data.decode())
     self.assertTrue(data['message'] == 'Failed!! User already exists')
     self.assertEqual(response.status_code, 200)
     user.delete()
Example #2
0
    def test_registered_user_login(self):

        response = base.base_registration(self)
        data = json.loads(response.data.decode())
        self.assertEqual(data['message'], 'Successfully added a user')

        response = base.login_user(
            self, email='*****@*****.**', password='******')
        data = json.loads(response.data.decode())
        self.assertEqual(data['message'], 'Successfully logged in')
Example #3
0
 def test_registration(self):
     """ Test for user registration """
     response = base.base_registration(self)
     data = json.loads(response.data.decode())
     self.assertTrue(data['message'] == 'Successfully added a user')
     self.assertEqual(response.status_code, 201)