def setUp(self): AccountModel.objects.create(username="******", password="******", name="supervisor", address="streetplace100", email="*****@*****.**", phonenumber="1235678", accountFlag=0) AccountModel.objects.create(username="******", password="******", name="admin", address="streetplace1", email="*****@*****.**", phonenumber="1235678", accountFlag=1) AccountModel.objects.create(username="******", password="******", name="instructor", address="streetplace2", email="*****@*****.**", phonenumber="1235678", accountFlag=2) AccountModel.objects.create(username="******", password="******", name="ta", address="streetplace3", email="*****@*****.**", phonenumber="1235678", accountFlag=3) CourseModel.objects.create(number="100", name="Engineering") LabModel.objects.create(name="Lab101") course = CourseModel.objects.get(number="100") lab = LabModel.objects.get(name="Lab101") lab.course = course logout(["logout"]) login(["login","sup123", "pass321"])
def testAssignTaLab6(self): # Correct Use logout(["logout"]) login(["login", "in123", "pass321"]) self.assertEqual(assignTALab(["assigntalab", "ta123", "Lab101"]), "TA Added")
def test_logoff1(self): # User logged in self.assertEqual(login(["login", "user123", "pass321"]), "Login Success") self.assertEqual(logout(["logout"]), "Logout Success")
def test_loginLogoff(self): # (Will fail until memory is complete) self.assertEqual(login(["login", "user123", "pass321"]), "Login Success") self.assertEqual(logout(["logout"]), "Logout Success")
def test_login8(self): # both, user logged in. Should return error self.assertEqual(login(["login", "user123", "pass321"]), "Login Success") self.assertEqual(login(["login", "user123", "pass321"]), "Another User is logged in")
def test_login9(self): self.assertEqual(login(["login", "too", "many", "arguments"]), "Error")
def test_login7( self): # only password, user logged in. Should return error self.assertEqual(login(["login", "password"]), "Error")
def test_login6( self): # only username, user logged in. Should return error self.assertEqual(login(["login", "user123"]), "Error")
def test_login5( self ): # No username and password entered, user logged in. Should return error self.assertEqual(login(["login"]), "Error")
def test_login4( self ): # both, no user logged in. Should pass(Will fail until memory is complete) self.assertEqual(login(["login", "user123", "pass321"]), "Login Success")
def test_wrong_pass(self): self.assertEqual(login(["login", "user123", "abcdefg"]), "Wrong Password")