예제 #1
0
class TestUser(unittest.TestCase):
	'''
	Test class that defines test cases for the user class behaviours.
	Args:
		unittest.TestCase: helps in creating test cases
	'''
	def setUp(self):
		'''
		Function to create a user account before each test
		'''
		self.new_user = User("Eve","evelyne","pswd100")

	def test__init__(self):
		'''
		Test to see if check the creation of user instances is properly done
		'''
		self.assertEqual(self.new_user.first_name,"Eve")
		self.assertEqual(self.new_user.last_name,"evelyne")
		self.assertEqual(self.new_user.password,"pswd100")

	# def tearDown(self):
	# 	'''
	# 	tearDown method that does clean up after each test case has run.
	# 	'''
	# 	User.user_list = []

	def test_save_user(self):
		'''
		Test to check if the new users info is saved into the users list
		'''
		self.new_user.save_user()
		self.assertEqual(len(User.user_list),1)
예제 #2
0
class TestUser(unittest.TestCase):
    '''
    Test class that defines test cases for the user class behaviours.

    Args:
    unittest.TestCase: TestCase that helps in creating test cases
    '''
    def setUp(self):
        '''
        SetUp method to run before each test cases
        '''
        self.new_user = User('Tabby' ,'Wanjiku' ,'twpd254')

    def test__init__(self):
        '''
        test_init test case to test if the object is initialized properly
        '''
        self.assertEqual(self.new_user.first_name,'Tabby')
        self.assertEqual(self.new_user.last_name,'Wanjiku')
        self.assertEqual(self.new_user.password,'twpd254') 

    def test_save_user(self):
        '''
        Test to check if the users info is saved in the users_list
        '''
        self.new_user.save_user() #saving the new user
        self.assertEqual(len(User.users_list),1)
예제 #3
0
def save_user(user):
    """
    Function to save a new user account
    :param user:
    :return:
    """
    User.save_user(user)
class TestUser(unittest.TestCase):
    '''
    Test class that defines test cases for the user class behaviours.

    Args:
        unittest.TestCase :TestCase class that helps in creating test cases 
    '''
    def setUp(self):
        '''
        Set up method to run before each test cases.  
        '''
        self.new_user = User("Ibrahim", "Hassib", "McGee")

    def test_init(self):
        '''
        test_init test case to test if the object is initialized properly
        '''

        self.assertEqual(self.new_user.first_name, "Ibrahim")
        self.assertEqual(self.new_user.last_name, "Hassib")
        self.assertEqual(self.new_user.password, "McGee")

    def test_save_user(self):
        '''
        test_save_user test case to test if the user object is saved into
        the user list
        '''

        self.new_user.save_user()
        self.assertEqual(len(User.user_list), 1)
class TestUser(unittest.TestCase):
    '''
    Test class that defines test cases for the User class behaviours

    Args:
        unittest.TestCase: TestCase class that helps in creating test cases
    '''
    def setUp(self):
        '''
        Set up method that will run before each test cases is executed
        '''
        self.new_user = User("Gideon", "Chef", "Been2000")

    def test_init(self):
        '''
        test_init test case to test if the object is initialized properly
        '''
        self.assertEqual(self.new_user.fname, "Gideon")
        self.assertEqual(self.new_user.lname, "Chef")
        self.assertEqual(self.new_user.password, "Been2000")

    def test_save_user(self):
        '''
        test_save_user test case to test if the user object is saved into
         the user_list
        '''
        self.new_user.save_user()
        self.assertEqual(len(User.user_list), 1)
예제 #6
0
class TestUser(unittest.TestCase):
    """
    test class defining cases for the user class behaviuor
    """
    def setUp(self):
        """
        function to create  account before test
        """

        self.newuser = User('Christine', 'Ombima', 'tyna452')

    def test__init__(self):
        """
        Test to check if account creation was done correctly
  		"""
        self.assertEqual(self.newuser.firstname, 'Christine')
        self.assertEqual(self.newuser.lastname, 'Ombima')
        self.assertEqual(self.newuser.password, 'tyna452')

    def test_save(self):
        """
      test to check if new user info is saved
      """
        self.newuser.save_user()
        self.assertEqual(len(User.users), 1)
class TestUser(unittest.TestCase):
    '''
    Test class that defines test cases for the User class behaviours.

    Args:
        unittest.TestCase: TestCase class that helps in creating test cases
    '''
    def setUp(self):
        '''
        Set up method to run before each test cases.
        '''
        self.new_user_account = User("GasaGentille", "555a")

    def test_init(self):
        '''
        test_init test case to test if the object is initialized properly
        '''
        self.assertEqual(self.new_user_account.user_username, "GasaGentille")
        self.assertEqual(self.new_user_account.user_password, "555a")

    def tearDown(self):
        '''
            tearDown method that does clean up after each test case has run.
            '''
        User.user_holder = []

    #SAVING OUR LOGIN DETAILS
    def test_save_user(self):
        '''
        test_save_user test case to test if the user object is saved into
         the user_holder
        '''
        self.new_user_account.save_user("GasaGentille", "555a")
        self.assertEqual(len(User.user_holder), 4)
예제 #8
0
class TestUser(unittest.TestCase):
    """
    Test class that defines test cases for the user class behaviours.
    Args:
        unittest.TestCase: helps in creating test cases
    """
    def setUp(self):
        """
        Function to create a user account before each test
        """
        self.new_user = User('Humphrey', 'Mutuma', '1234')

    def test__init__(self):
        """
        Test to if check the initialization/creation of user instances is properly done
        """
        self.assertEqual(self.new_user.first_name, 'Humphrey')
        self.assertEqual(self.new_user.last_name, 'Mutuma')
        self.assertEqual(self.new_user.password, '1234')

    def test_save_user(self):
        """
        Test to check if the new users info is saved into the users list
        """
        self.new_user.save_user()
        self.assertEqual(len(User.users_list), 1)
예제 #9
0
class TestCredentials(unittest.TestCase):
    """
    test class defining cases for the credentials class behaviuor
    """
    def confirm_user(self):
        """
      function to confirm 
      """

        self.newuser = User("Christine", "Ombima", "tyna452")
        self.newuser.save_user()
        user2 = User("alex", "nad", "nad452")
        user2.save_user()

        for user in User.users:
            if user.firstname == user2.firstname and user.password == user2.password:
                current_user = user.firstname
        return current_user

    #   self.assertEqual(current_user,Credential.confirm_user(user2.firstname,user2.password))

    def setUp(self):
        """
      function to create create credentials before test
      """
        self.new_credential = Credential("Christine", "Facebook",
                                         "chrisombima", "tyna452")

    def test__init__(self):
        """
        test to check if credential were created correctly
        """
        self.assertEqual(self.new_credential.username, "Christine")
        self.assertEqual(self.new_credential.sitename, "Facebook")
        self.assertEqual(self.new_credential.accountname, "chrisombima")
        self.assertEqual(self.new_credential.password, "tyna452")

    def test_save_credentials(self):
        """
        test to check if new credentials info has been saved
        """
        self.new_credential.save_credentials()
        twitter = Credential("alex", "Twitter", "nad", "nad452")
        twitter.save_credentials()
        self.assertEqual(len(Credential.credentials), 4)

    def test_copy_credential(self):
        """
        test to confirm credential method copies correctly
        """
        self.new_credential.save_credentials()
        twitter = Credential("alex", "Twitter", "nad", "nad254")
        twitter.save_credentials()
        find_credential = None
        for credential in Credential.credentials:
            find_credential = Credential.find_site_by_name(credential.sitename)
            return pyperclip.copy(find_credential.password)
        Credential.copy_credentials(self.new_credential.sitename)
        self.assertEqual("tyna452", pyperclip.paste())
        print(pyperclip.paste())
예제 #10
0
class TestUser(unittest.TestCase):
    '''
	Test class that defines test cases for the user class behaviours.

	Args:
	    unittest.TestCase: helps in creating test cases
	'''
    def setUp(self):
        '''
		Function to create a user account before each test
		'''
        self.new_user = User('peter', 'Ng\'ang\'a', 'pswd100')

    def test__init__(self):
        '''
		Test to if check the initialization/creation of user instances is properly done
		'''
        self.assertEqual(self.new_user.first_name, 'peter')
        self.assertEqual(self.new_user.last_name, 'Ng\'ang\'a')
        self.assertEqual(self.new_user.password, 'pswd100')

    def test_save_user(self):
        '''
		Test to check if the new users info is saved into the users list
		'''
        self.new_user.save_user()
        self.assertEqual(len(User.users_list), 1)
	def test_check_user(self):
		'''
		Function to test whether the login in function check_user works as expected
		'''
		self.new_user = User('Loise','Ki\'Me\'u','password000')
		self.new_user.save_user()
		user2 = User('Jam','Ma\'ye\'ye','password001')
		user2.save_user()
예제 #12
0
 def test_save_multiple_user(self):
     '''
     test-save_multiple_user to check if we can save multiple 
     user objects to our user_list
     '''
     self.new_user.save_user()
     test_user = User("Ace", "1234")  #new User
     test_user.save_user()
     self.assertEqual(len(User.user_list), 2)
 def test_save_multiple_users(self):
     """
     test_save_multiple_users check if we can save multiple user
     objects to our user_list
     """
     self.new_user.save_user()
     test_user= User("FirstName","LastName","*****@*****.**", "AnotherPassword")
     test_user.save_user()
     self.assertEqual(len(User.users_list),2)
예제 #14
0
    def test_save_multiple_users(self):
        """
        Check if we can save multiple user objects to our user_list.
        """

        self.new_user.save_user()
        test_user = User("Test", "User", "tuser", "testing20")
        test_user.save_user()
        self.assertEqual(len(User.user_list), 2)
예제 #15
0
 def test_delete_user(self):
     '''
 Test to check whether a user can remove their account
 
 '''
     self.new_user.save_user()
     test_user = User("BMuthoni", "4676jl")
     test_user.save_user()
     self.new_user.delete_user()
     self.assertEqual(len(User.users_list), 1)
예제 #16
0
    def test_save_multiple_user(self):
        '''
        check to see if multiple users can be saved
        '''

        self.new_user.save_user()
        test_user = User("Ann", "Bridgit", "brig13")

        test_user.save_user()
        self.assertEqual(len(User.user_list), 2)
 def test_delete_user(self):
     """
     test_delete_user method tests if we can remove a user from the user_list
     """
     self.new_user.save_user()
     test_user= User("FirstName","LastName","*****@*****.**", "AnotherPassword")
     test_user.save_user()
     
     self.new_user.delete_user()
     self.assertEqual(len(User.users_list),1)
예제 #18
0
    def test_user_exists(self):
        """
        Test to check if we can return a Boolean if we cannot find the user.
        """

        self.new_user.save_user()
        test_user = User("Test", "User", "tuser", "testing20")
        test_user.save_user()
        user_exists = User.user_exist("tuser")
        self.assertTrue(user_exists)
예제 #19
0
    def test_verify_user(self):
        """
        Test to check if we can return a Boolean if the user login deatils don't match.
        """

        self.new_user.save_user()
        test_user = User("Test", "User", "tuser", "testing20")
        test_user.save_user()
        user_verification = User.verify_user("tuser", "testing20")
        self.assertTrue(user_verification)
예제 #20
0
    def test_find_user_by_login_name(self):
        '''
        test to check if we can find a credentials by login_name and display information
        '''

        self.new_user.save_user()
        test_user = User("Ace", "1234")  #new user
        test_user.save_user()

        found_user = User.find_by_login_name("Ace")
        self.assertEqual(found_user.login_name, test_user.login_name)
예제 #21
0
class TestUser(unittest.TestCase):
    def setUp(self):
        self.new_user = User('Dancan', 'Od\'uo\'r', '28750187')

    def test__init__(self):
        self.assertEqual(self.new_user.first_name, 'Dancan')
        self.assertEqual(self.new_user.last_name, 'Od\'uo\'r')
        self.assertEqual(self.new_user.password, '28750187')

    def test_save_user(self):
        self.new_user.save_user()
        self.assertEqual(len(User.users_list), 1)
예제 #22
0
    def test_delete_user(self):
        '''
        Deletes the user from the user_list
        '''

        self.new_user.save_user()
        test_user = User("Ann", "Bridgit", "brig13")

        test_user.save_user()

        self.new_user.delete_user()
        self.assertEqual(len(User.user_list), 1)
예제 #23
0
    def test_user_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the credentials.
        '''

        self.new_user.save_user()
        test_user = User("Ace", "1234")  # new credentials
        test_user.save_user()

        user_exists = User.user_exist("Ace")

        self.assertTrue(user_exists)
예제 #24
0
    def test_check_user(self):
        self.new_user = User('Dancan', 'Od\'uo\'r', '28750187')
        self.new_user.save_user()
        user2 = User('Ben', 'Od\'uo\'r', '28750187')
        user2.save_user()

        for user in User.users_list:
            if user.first_name == user2.first_name and user.password == user2.password:
                current_user = user.first_name
        self.assertEqual(
            current_user,
            Credential.check_user(user2.password, user2.first_name))
        return current_user
    def test_user_login(self):
        '''
                        Function to test whether the login in function login_user works as expected
                        '''
        self.new_user = User("Alex", "mwaura", "12345")
        self.new_user.save_user()
        user_login = User("test", "user", "1122")
        user_login.save_user()

        for user in User.users_list:
            if user.first_name == user_login.first_name and user.password == user_login.password:
                current_user = user.first_name
                return current_user
예제 #26
0
    def test_check_user(self):
        """
        Function to test whether the login in function check_user works as expected
        """
        self.new_user = User('Humphrey', 'Mutuma', '1234')
        self.new_user.save_user()
        user2 = User('Alex', 'Mutuma', '1234')
        user2.save_user()

        for user in User.users_list:
            if user.first_name == user2.first_name and user.password == user2.password:
                current_user = user.first_name
        return current_user
예제 #27
0
    def test_check_user(self):
        '''
        Function to confirm the login info
        '''
        self.new_user = User('Esther', 'Mumbi', 'essy17')
        self.new_user.save_user()
        user2 = User('Maria', 'Mwema', 'Maria17')
        user2.save_user()

        for user in User.user_list:
            if user.first_name == user2.first_name and user.password == user2.password:
                current_user = user.first_name
                return current_user
class TestUser(unittest.TestCase):
    '''
    Test class that defines test cases for the user class behaviours.

    Args:
    unittest.TestCase: TestCase class that helps in creating test cases.
    '''
    def setUp(self):
        '''
        Set up method to run before each check if pyperclip is installedtest cases.
        '''
        self.new_user = User('Monica', 'Oyugi',
                             'ndito123')  #create user object

    def test__init__(self):
        '''
        Test case to test if the object is initialized properly.
        '''
        self.assertEqual(self.new_user.first_name, "Monica")
        self.assertEqual(self.new_user.last_name, "Oyugi")
        self.assertEqual(self.new_user.password, "ndito123")

    def tearDown(self):
        '''
        A method that clears the users list after every test.
        '''
        User.users_list = []

    def test_save_user(self):
        '''
        Test case to test if the user object is saved to the users list.
        '''
        self.new_user.save_user()
        self.assertEqual(len(User.users_list), 1)

    def test_check_user(self):
        '''
        Test case to test whether login feature is functional.
        '''
        self.new_user = User('Monica', 'Oyugi', 'ndito123')
        self.new_user.save_user()
        user2 = User('Martin', 'Owiti', '@#Omosh')
        user2.save_user()

        for user in User.users_list:
            if user.first_name == user2.first_name and user.password == user2.password:
                current_user = user.first_name
        return current_user

        self.assertEqual(current_user,
                         User.check_user(user2, password, user2.first_name))
예제 #29
0
    def confirm_user(self):
        """
      function to confirm 
      """

        self.newuser = User("Christine", "Ombima", "tyna452")
        self.newuser.save_user()
        user2 = User("alex", "nad", "nad452")
        user2.save_user()

        for user in User.users:
            if user.firstname == user2.firstname and user.password == user2.password:
                current_user = user.firstname
        return current_user
예제 #30
0
	def test_check_user(self):
		'''
		Function to test whether the login in function check_user works as expected
		'''
		self.new_user = User("Eve","evelyne","pswd100")
		self.new_user.save_user()
		user2 = User("Aggy","agnes","pswd200")
		user2.save_user()

		for user in User.user_list:
			if user.first_name == user2.first_name and user.password == user2.password:
				current_user = user.first_name
		return current_user

		self.assertEqual(current_user,Credential.check_user(user2.password,user2.first_name))