def test_delete_credential(self):
     '''
     test case to check if an unwanted credential is deleted
     '''
     self.new_credential.save_credential()
     test_credential = Credential("anum","Instagram","anumasif","fdsf134csd")
     test_credential.save_credential()
     test_credential.delete_credential()
     self.assertEqual(len(Credential.credential_list),1)
Пример #2
0
 def test_delete_credential(self):
     '''
     test case to check if an unwanted credential is deleted
     '''
     self.new_credential.save_credential()
     test_credential = Credential("henry", "facebook", "halkano",
                                  "fdsf134csd")
     test_credential.save_credential()
     test_credential.delete_credential()
     self.assertEqual(len(Credential.credential_list), 1)
Пример #3
0
    def test_delete_credential(self):
        """
		test if one can remove a user from credential list
		"""
        self.new_credential.delete_credential()
        test_credential = Credential("Arijm", "*****@*****.**",
                                     "instagram", "mango")  #new credential
        test_credential.delete_credential()
        self.new_credential.delete_credential()
        self.assertEqual(len(Credential.credential_list), 3)
Пример #4
0
class TestCredential(unittest.TestCase): 
    def setUp(self):
        """
        set up method to run before each test cases
        """
        self.new_credential=Credential('facebook',"barackmaundu","387r7b7a")   
    def test_account_exist(self):
        """
        account_exist checks if account new_credintial exist
        """
        self.assertEqual(self.new_credential.user_name,"barackmaundu")
       
    def test_save_credential(self):
        """
        To save new_credential_accont in the credential list
        """
        self.new_credential.save_credential()
        self.assertEqual(len(Credential.credential_list),1) 
    def test_save_multiple_credential(self):
        """
        To test how to save multiple
        """
        self.new_credential.save_credential()
        test_credential=Credential('twitter',"barackmaundu",'387r7b7a')
        test_credential.save_credential()  

        self.assertEqual(len(Credential.credential_list),2)
    
    def test_delete_credential(self):
        """
        To test if credentail can be deleted
        """
        self.new_credential.save_credential()
        test_credential=Credential('twitter',"barackjunior",'387r3b7a')
        test_credential.save_credential()  

        self.new_credential.delete_credential()
        self.assertEqual(len(Credential.credential_list),1)
    def tearDown(self):
        '''
        tearDown method that does clean up after each test case has run.
        '''
        Credential.credential_list = []
    def display_credential(self):
        """
        to test if credentials can be displayed using method
        """
        self.assertEqual(Credential.display_credentials(),Credential.credential_list)     
Пример #5
0
def delete_credential(Credential):

    Credential.delete_credential()
Пример #6
0
class CredentialTest(unittest.TestCase):
    def setUp(self):

        self.new_credential = Credential("twiter", "manjeru", 1234567)

    def test__init(self):

        self.assertEqual(self.new_credential.account, "twiter")
        self.assertEqual(self.new_credential.username1, "manjeru")
        self.assertEqual(self.new_credential.password1, 1234567)

    def test_save_credetial(self):

        self.new_credential.save_credential()
        self.assertEqual(len(Credential.credential_list), 1)

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

    def test_save_multiple_credential(self):
        '''
                test_save_multiple_contact to check if we can save multiple contact
                objects to our contact_list
                '''
        self.new_credential.save_credential()
        test_credential = Credential("Test"
                                     "whatsapp", "manjeru",
                                     1234567)  # new credetial
        test_credential.save_credential()
        self.assertEqual(len(Credential.credential_list), 2)

    def test_delete_credential(self):
        '''
                test_delete_contact to test if we can remove a contact from our contact list
                '''
        self.new_credential.save_credential()
        test_credential = Credential("Test"
                                     "whatsapp", "manjeru",
                                     1234567)  # new credetial
        test_credential.save_credential()

        self.new_credential.delete_credential()  # Deleting a contact object
        self.assertEqual(len(Credential.credential_list), 1)

    def test_find_credentials(self):
        self.new_credential.save_credential()
        test_credential = Credential("whatsapp", "manjeru", 12345)
        test_credential.save_credential()

        found_credential = Credential.find_by_account('whatsapp')
        found_credential = found_credential
        self.assertEqual(found_credential, test_credential)

    def test_credential_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the contact.
        '''

        self.new_credential.save_credential()
        test_credential = Credential("whatsapp", "manjeru",
                                     12345)  # new contact
        test_credential.save_credential()

        credential_exists = Credential.credential_exist("whatsapp")

        self.assertTrue(credential_exists)

    def test_display_all_credential(self):
        '''
        method that returns a list of all contacts saved
        '''

        self.assertEqual(Credential.display_credential(),
                         Credential.credential_list)
Пример #7
0
def delete_credential(account_name):
    '''
    deletes a credential
    '''
    Credential.delete_credential(account_name)
Пример #8
0
class TestCredential(unittest.TestCase):
        """
        Test class that defines test cases for credentials

        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_credential = Credential("Instagram","mkambezz3")

        def test_init(self):
            """
            Used to check if the object is initialized properly

            """
            self.assertEqual(self.new_credential.account_name,"Instagram")
            self.assertEqual(self.new_credential.password,"mkambezz3")

        def test_create_credentials(self):
            """
            Function to save a newly created user intsnace
            """
            Credential.credential_list.append(self)

        def  pass_gen(size = 8,chars=string.ascii_letters + string.digits + string.punctuation):
            return ''.join(random.choice(chars)for _ in range(size))

        def test_save_credential(self):
            """
            Test function to save a newly created credential
            """
            self.new_credential.save_credential()
            self.assertEqual(len(Credential.credential_list),2)

        # def test_find_credential_by_account_name(self):
        #     """
        #     Test function for finding credentials.
        #     """
        #     self.new_credential.save_credential()
        #     test_credential=Credential("Instagram","mkambezz3")
        #     test_credential.save_credential()
        #
        #     found_credential = Credential.find_by_account_name('Instagram','mkambezz3')
        #     self.assertEqual(found_credential.ppassword,test_credential.password)

        def delete_credential(self):
            """
            Function that deletes a saved credential

            """
            self.new_credential.delete_credential()
            test_credential = Credential("account_name","sara334")
            self.assertEqual(len(Credential.credential_list),1)

        def test_display_all_credentials(self):
            """
            returns all list of all contacts

            """
            self.assertEqual(Credential.display_credentials(),Credential.credential_list)
Пример #9
0
def delete_credential(credential):
    '''
    to save all credentials
    '''
    Credential.delete_credential(credential)
Пример #10
0
class TestCredential(unittest.TestCase):
    """
	test class that defines the test case for credential class
	"""
    def setUp(self):
        """
		a setup method to run before each testcase
		"""
        self.new_credential = Credential("Arijm", "*****@*****.**",
                                         "instagram", "mango")

    def test__init__(self):
        """
		testcase to test if the object is initialized
		"""
        self.assertEqual(self.new_credential.user_name, "Arijm")
        self.assertEqual(self.new_credential.email, "*****@*****.**")
        self.assertEqual(self.new_credential.acc, "instagram")
        self.assertEqual(self.new_credential.password, "mango")

    def test_save_credential(self):
        """
		test case to test if the credential are saved into credential list
		"""
        # self.new_credential.save_credential()#saving the new credential
        self.assertEqual(len(Credential.credential_list), 0)

    def tearDown(self):
        """
		it does clean up after each and every test has run
		"""
        Credential.credential_list = []
        User.credential_list = []

    def test_save_multiple_credential(self):
        """
		test to check if we can save multiple credentials
		"""
        # self.new_credential.save_credential()
        test_credential = Credential("Arijm", "*****@*****.**",
                                     "instagram", "mango")  #new credential
        self.assertEqual(len(Credential.credential_list), 0)

    def test_delete_credential(self):
        """
		test if one can remove a user from credential list
		"""
        self.new_credential.delete_credential()
        test_credential = Credential("Arijm", "*****@*****.**",
                                     "instagram", "mango")  #new credential
        test_credential.delete_credential()
        self.new_credential.delete_credential()
        self.assertEqual(len(Credential.credential_list), 3)

    def test_find_credential_by_username(self):
        """
		test to check if we can find a user by his name
		"""
        self.new_credential.save_credential()
        test_credential = Credential("Arijm", "*****@*****.**",
                                     "instagram", "mango")  #new credential
        test_credential.save_credential()
        found_credential = Credential.find_by_user_name("Arijm")
        self.assertEqual(found_credential.user_name, test_credential.user_name)

    def test_credential_exist(self):
        """
		testing if we can return a Boolean if the credential is not found
		"""
        self.new_credential.save_credential()
        test_credential = Credential("Arijm", "*****@*****.**",
                                     "instagram", "mango")  #new credential
        test_credential.save_credential()
        credential_exists = Credential.credential_exists("Arijm")
        self.assertTrue(credential_exists)

    def test_display_all_credential(self):
        """
		a method that returns a list of all credentials saved
		"""
        self.assertEqual(Credential.display_credential(),
                         Credential.credential_list)

    def test_copy_email(self):
        """
		test to confirm we are copying an email address from a found credential
		"""
        self.new_credential.save_credential()
        Credential.copy_email("Arijm")
        self.assertEqual(self.new_credential.email, pyperclip.paste())
Пример #11
0
class TestCredential(unittest.TestCase):
      '''
      Test class that defines test cases for credentials class behaviours.

      Args:
      unittest.TestCase:TestCase class helping in creating test cases
      '''   

      def setUp(self):
        '''
        Set up method to run before each test cases.
        ''' 
        self.new_credential = Credential ("Facebook","Gift Lumumba","0721851691") #created credentials object

      def tearDown(self):
        '''
        tearDown method that does clean up after each test has been run
        '''  
        Credential.credential_list = []

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

        self.assertEqual(self.new_credential.account_name,"Facebook")
        self.assertEqual(self.new_credential.username,"Gift Lumumba")
        self.assertEqual(self.new_credential.password,"0721851691")

      def test_save_credential(self):
        '''
        test_save_credentials test case to test if the credentials object has been saved into the credentials list
        '''  
        self.new_credential.save_credential() #saving new credentials
        self.assertEqual(len(Credential.credential_list),1)

      def test_save_multiple_credential(self):
        '''
        method that checks if we can save multiple credentials objects to credentials_list
        '''  
        self.new_credential.save_credential()
        test_credential = Credential("Github","Gift-Lumumba","gL0711419032")
        test_credential.save_credential()
        self.assertEqual(len(Credential.credential_list),2)

      def test_delete_credential(self):
        '''
        tests if we can delete a credential from our credentials list
        '''  
        self.new_credential.save_credential()
        test_credential = Credential("Github","Gift-Lumumba","gL0711419032")
        test_credential.save_credential()

        self.new_credential.delete_credential() #deletes credentials object
        self.assertEqual (len(Credential.credential_list),1)

      def test_find_credential_by_account_name(self):
        '''
        to check if we can find a credential by the account name and display more information about it
        '''  
        self.new_credential.save_credential()
        test_credential = Credential("Github","Gift-Lumumba","gL0711419032")
        test_credential.save_credential()

        found_credential =Credential.find_by_account_name("Github")
        self.assertEqual(found_credential.password,test_credential.password)

      def test_credential_exists(self):
        '''
        checks if we can return a boolean if we cannot find the credentials
        '''  

        self.new_credential.save_credential()
        test_credential = Credential("Github","Gift-Lumumba","gL0711419032")
        test_credential.save_credential()

        credential_exists =Credential.credential_exists("Github")
        self.assertTrue(credential_exists)

      def test_display_all_credential(self):
        '''
        returns a list of all credentials saved 
        '''  

        self.assertEqual( Credential.display_credential(),Credential.credential_list)

      def test_copy_account_name(self):
        '''
        test to confirm we are copying the account name from a found credentials
        '''

        self.new_credential.save_credential()
        Credential .copy_account_name("Facebook")

        self.assertEqual(self.new_credential.account_name,pyperclip.paste())
Пример #12
0
def del_credential(credential):
    """
    Function to delete a credential
    """
    Credential.delete_credential(credential)
Пример #13
0
class TestCredential(unittest.TestCase):
    """
    Test class that defines test cases for the contact class behaviours

    Args:
        unittest.TestCase: TestCase class that helps in creating test cases

    """
    def setUp(self):
        """
        Set up method to run before each test case.
        """
        self.new_credential = Credential ("Reddit","ozzyman","23iiihihs") #create user object

    def tearDown(self):
        """
        tearDown method that does the clean-up after each test has run
        """ 
        Credential.credential_list = []

    def test_init(self):
        """
        test_init test case to test if the object is initialized properly
        """
        self.assertEqual(self.new_credential.acc_name,"Reddit")

    def test_save_credential(self):
        """
        test to check if the credential object is saved on credential list
        """
        self.new_credential.save_credential() #save user
        self.assertEqual(len(Credential.credential_list),1)

    def test_save_multiple_credential(self):
        """
        To check if we can save multiple objects into list
        """
        self.new_credential.save_credential()
        test_credential = Credential ("Twitter","khaleesifan","24hugugugu")
        test_credential.save_credential()
        self.assertEqual(len(Credential.credential_list),2)

    def test_delete_credential(self):
            '''
            test_delete_contact to test if we can remove credential from our credential list
            '''
            self.new_credential.save_credential()
            test_credential = Credential ("Twitter","khaleesifan","24hugugugu") # new credential
            test_credential.save_credential()

            self.new_credential.delete_credential()# Deleting a credential object
            self.assertEqual(len(Credential.credential_list),1)

    def test_find_credential_by_acc_name(self):
        '''
        test to check if we can find a credential by account name and display information
        '''

        self.new_credential.save_credential()
        test_credential = Credential ("Twitter","khaleesifan","24hugugugu") # new credential
        test_credential.save_credential()

        found_credential = Credential.find_by_acc_name("Twitter")

        self.assertEqual(found_credential.pword,test_credential.pword)

    def test_credential_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the credential.
        '''

        self.new_credential.save_credential()
        test_credential = Credential ("Twitter","khaleesifan","24hugugugu") # new credential
        test_credential.save_credential()

        credential_exists = Credential.credential_exist("Twitter")

        self.assertTrue(credential_exists)

    def test_display_all_credential(self):
        '''
        method that returns a list of all credentials saved
        '''

        self.assertEqual(Credential.display_credential(),Credential.credential_list)
Пример #14
0
class TestCredential(unittest.TestCase):
    '''
    class for test case that check the behaviours of the credential class
    '''
    def setUp(self):
        '''
        set up method to run before each test case
        '''
        self.new_credential=Credential("kingkong","qweasdzxc","facebook")
    def test_init_credential(self):
        '''
        to test if the credential object is prpperly initilize
        '''
        self.assertEqual(self.new_credential.user_name,"kingkong")
        self.assertEqual(self.new_credential.password,"qweasdzxc")
        self.assertEqual(self.new_credential.account_name,"facebook")
    def test_save_credential(self):
        '''
        function to test if we can save the credential in credential list
        '''
        self.new_credential.save_credential()# method that saves the credential object
        self.assertEqual(len(Credential.credential_list),1)
    def tearDown(self):
        '''
        setdown method if clear each test case after they have run
        '''
        Credential.credential_list=[]#empty 
    def test_delete_credential(self):
        '''
        function for  test case to see if we can delete the 
        credential object from credential list
        '''
        self.new_credential.save_credential()
        test_credential=Credential("kingkong","qweasdzxc","facebook")
        self.new_credential.delete_credential()# deleting the credential object from the list
        self.assertEqual(len(Credential.credential_list),0)
    def test_find_credential(self):
        '''
        function for test case to test if we can find the credential object from the list
        '''
        self.new_credential.save_credential()
        test_credential=Credential("kingkong","qweasdzxc","facebook")
        test_credential.save_credential()

        find_credential=Credential.find_by_user_name("kingkong")# finding the credential by its user_name
        self.assertEqual(find_credential.user_name,test_credential.user_name)
    def test_display_credential(self):
        '''
        method that checks to see we can return a list of the credential
        '''
        self.assertEqual(Credential.display_credential(),Credential.credential_list)# method for check displaying function works
    def test_copy_credential(self):
        '''
        function for test case to see if can copy a credential
        '''
        self.new_credential.save_credential()
        test_credential=Credential("kingkong","qweasdzxc","facebook")# new object
        test_credential.save_credential()# save the object
        find_credential=None
        for credential in Credential.credential_list:
            found_credential=Credential.find_by_user_name(credential.user_name)
            return pyperclip.copy(found_credential.password)
            Credential.copy_credential(self.new_credential.user_name) 
            self.assertEqual("qweasdzxc",pyperclip.paste())