def testLogin2(self): """ Tests that login twice after adding a user works and count is properly updated """ self.assertEquals(1, UsersModel.add("user1", "password")) self.assertEquals(2, UsersModel.login("user1", "password")) self.assertEquals(3, UsersModel.login("user1", "password"))
def testLogin3(self): """ Tests that logging in works for 2 newly created users, and counters properly updated """ self.assertEquals(1, UsersModel.add("user1", "password")) self.assertEquals(1, UsersModel.add("user2", "password")) self.assertEquals(2, UsersModel.login("user1", "password")) self.assertEquals(2, UsersModel.login("user2", "password"))
def testLogin4(self): """ Tests that login with an empty password works """ self.assertEquals(1, UsersModel.add("user1", "")) self.assertEquals(2, UsersModel.login("user1", ""))
def testLoginDifferentUser(self): """ Tests that login with different usernames for the same password fails """ self.assertEquals(1, UsersModel.add("user1", "password")) self.assertEquals(-1, UsersModel.login("user2", "password"))
def testLoginDifferentPassword(self): """ Tests that login with a different password for the same username fails """ self.assertEquals(1, UsersModel.add("user1", "password")) self.assertEquals(-1, UsersModel.login("user1", "wrong"))
def testNonExistentLogin(self): """ Tests that login for a user that doesn't exist fails """ self.assertEquals(-1, UsersModel.login("user1", "password"))