def test_login(self): self.Administrator1 = Administrator("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT") self.assertEquals( Administrator.login("*****@*****.**", "DEFAULT_PASSWORD"), "Login successful") model_administrator1 = models.ModelPerson.objects.get( email=self.Administrator1.email) self.assertTrue(model_administrator1.isLoggedOn) self.assertEquals( Administrator.login("*****@*****.**", "DEFAULT_PASSWORD"), "User already logged in") self.assertEquals(Administrator.login("*****@*****.**", "password"), "User already logged in")
def test_logout(self): self.Administrator1 = Administrator("*****@*****.**", "DEFAULT_PASSWORD", "DEFAULT") self.assertEquals( Administrator.login("*****@*****.**", "DEFAULT_PASSWORD"), "Login successful") self.assertTrue(self.Administrator1.logout())