Пример #1
0
 def testLoginInvalidPassword(self):
     """
     Tests login with wrong password
     """
     BeatMyGoalUser.create('user1', '*****@*****.**', 'pw')
     response = BeatMyGoalUser.login('user1','pww')
     self.assertTrue(response['errors'])
Пример #2
0
 def testLoginUser(self):
     """
     Tests login with registered username
     """
     BeatMyGoalUser.create('user1', '*****@*****.**', 'pw')
     response = BeatMyGoalUser.login('user1', 'pw')
     self.assertTrue(not response['errors'])
Пример #3
0
 def testCreateDuplicateEmail(self):
     """
     Tests that creating account with already existing email works
     """
     response1 = BeatMyGoalUser.create('user1', '*****@*****.**', 'pw')
     self.assertTrue(not response1['errors'])
     response2 = BeatMyGoalUser.create('user2', '*****@*****.**', 'pw')
     self.assertTrue(response2['errors'])
     self.assertFalse(CODE_DUPLICATE_USERNAME in response2['errors'])
     self.assertTrue(CODE_DUPLICATE_EMAIL in response2['errors'])
Пример #4
0
 def testCreateUser(self):
     """
     Tests that creating new user works
     """
     response = BeatMyGoalUser.create('user1', '*****@*****.**', 'pw')
     self.assertTrue(not response['errors'])
     userid = BeatMyGoalUser.objects.get(username = '******')
     self.assertEqual('*****@*****.**', userid.email)
Пример #5
0
 def testRemoveUser(self):
     """
     test delete method in models
     """
     response = BeatMyGoalUser.create('test_user_view','test_email_view','test_password_view')
     test_user = response['user']
     test_user_userid = test_user.id
     response1 = BeatMyGoalUser.remove(test_user_userid)
     self.assertTrue(not response1['errors'])
     response2 = BeatMyGoalUser.getUserById(test_user_userid)
     self.assertTrue(response2['errors'])
Пример #6
0
 def testGetUserbyId(self):
     """
     test getUserById method in models
     """
     responce = BeatMyGoalUser.create('test_user_view','test_email_view','test_password_view')
     test_user = responce['user']
     test_user_userid = test_user.id
     test_user_username = test_user.username
     test_user_email = test_user.email
     response = BeatMyGoalUser.getUserById(test_user_userid)
     self.assertTrue(not response['errors'])
     user = response['user']
     self.assertEqual(test_user_userid,user.id)
     self.assertEqual(test_user_username,user.username)
     self.assertEqual(test_user_email,user.email)
Пример #7
0
 def testCreateEmptyPassword(self):
     """
     Tests that creating account with empty password
     """
     response = BeatMyGoalUser.create('user1', '*****@*****.**', '')
     self.assertTrue(response['errors'])
Пример #8
0
 def testCreateEmptyEmail(self):
     """
     Tests that creating account with empty email
     """
     response = BeatMyGoalUser.create('user1', '', 'pw')
     self.assertTrue(response['errors'])
Пример #9
0
 def testCreateEmptyUsername(self):
     """
     Tests that creating account with empty username
     """
     response = BeatMyGoalUser.create('', '*****@*****.**', 'pw')
     self.assertTrue(response['errors'])