Ejemplo n.º 1
0
 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"))
Ejemplo n.º 2
0
 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"))
Ejemplo n.º 3
0
    def testLogin4(self):
		"""
		Tests that login with an empty password works
		"""
		self.assertEquals(1, UsersModel.add("user1", ""))
		self.assertEquals(2, UsersModel.login("user1", ""))
Ejemplo n.º 4
0
    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"))        
Ejemplo n.º 5
0
    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"))
Ejemplo n.º 6
0
    def testNonExistentLogin(self):
		"""
		Tests that login for a user that doesn't exist fails
		"""
		self.assertEquals(-1, UsersModel.login("user1", "password"))
Ejemplo n.º 7
0
 def testAddEmptyUsername(self):
     """
     Tests that adding an user with empty username fails
     """
     self.assertEquals(-3, UsersModel.add("", "password"))
Ejemplo n.º 8
0
 def testAdd2(self):
     """
     Tests that adding two users works
     """
     self.assertEquals(1, UsersModel.add("user1", "password"))
     self.assertEquals(1, UsersModel.add("user2", "password"))
Ejemplo n.º 9
0
 def testAddExists(self):
     """
     Tests that adding a duplicate user name fails
     """
     self.assertEquals(1, UsersModel.add("user1", "password"))
     self.assertEquals(-2, UsersModel.add("user1", "password"))
Ejemplo n.º 10
0
 def testAdd1(self):
     """
     Tests that adding a user works
     """
     self.assertEquals(1, UsersModel.add("user1", "password1"))