def test_createDelete(self): testusername = "******" % (randint(100, 999)) newuser = User.create(testusername, "xxx") self.assertIsNotNone(newuser) self.assertTrue(User.exists(testusername)) newuser.delete() self.assertFalse(User.exists(testusername))
def createTestUser(self): if User.exists(self.username) is False: newuser = User.create(self.username, self.password)
def test_randomUserDoesntExists(self): randomname = "testrandom%s" % (randint(100, 999)) exists = User.exists(randomname) self.assertFalse(exists)
def test_authenticateCorrect(self): self.createTestUser() self.assertTrue(User.exists(self.username)) authuser = User.authenticate(self.username, self.password) self.assertEqual(self.username, authuser.username)
def test_adminUserExists(self): exists = User.exists("admin") self.assertTrue(exists)