Exemplo n.º 1
0
 def test_08_duplicate_username(self):
     expect_records(self, User, 0)
     User.objects.create(username="******", email="", password="******")  # 1
     try:
         User.objects.create(username="******", email="",
                             password="******")  # 1
         raise Exception("can not create a" +
                         " user with duplicate username")
     except Exception as e:
         #print(str(e))
         self.assertEqual(str(e),
                          "UNIQUE constraint failed: users_user.username")
     expect_records(self, User, 1)
     print("test_08_duplicate_username")
Exemplo n.º 2
0
 def test_07_delete_all_records(self):
     populate_users()
     expect_records(self, User, 20)
     delete_all_records()
     expect_records(self, User, 0)
     print("test_07_delete_all_records")
Exemplo n.º 3
0
 def test_06_delete_users(self):
     expect_records(self, User, 20)
     delete_users()
     expect_records(self, User, 0)
     print("test_06_delete_users")
Exemplo n.º 4
0
 def test_05_populate_users(self):
     expect_records(self, User, 20)
     populate_users()
     expect_records(self, User, 20)
     print("test_05_repopulate_users")
Exemplo n.º 5
0
 def test_03_delete_a_user(self):
     expect_records(self, User, 1)
     User.objects.first().delete()
     expect_records(self, User, 0)
     print("test_03_delete_a_user")
Exemplo n.º 6
0
 def test_02_create_a_user(self):
     User.objects.create(username="******", email="", password="******")  # 1
     expect_records(self, User, 1)
     print("test_02_create_a_user")
Exemplo n.º 7
0
 def test_01_make_sure_no_users(self):
     expect_records(self, User, 0)
     print("test_01_make_sure_no_users")