def test_save_many_accounts(self):
     '''
     test to check if we can save multiple credentials objects to our credentials list
     '''
     self.new_credential.save_details()
     test_credential = Credentials("Twitter","robaa38","Mfh45hfk") 
     test_credential.save_details()
     self.assertEqual(len(Credentials.credentials_list),2)
 def test_credential_exist(self):
     """
     test to check if we can return a true or false based on whether we find or can't find the credential.
     """
     self.new_credential.save_details()
     the_credential = Credentials("Twitter", "robaa38", "Mfh45hfk")  
     the_credential.save_details()
     credential_is_found = Credentials.if_credential_exist("Twitter")
     self.assertTrue(credential_is_found)
    def test_delete_credential(self):
        """
        test method to test if we can remove an account credentials from our credentials_list
        """
        self.new_credential.save_details()
        test_credential = Credentials("Twitter","robaa38","Mfh45hfk")
        test_credential.save_details()

        self.new_credential.delete_credentials()
        self.assertEqual(len(Credentials.credentials_list),1)
    def test_find_credentialr(self):
        """
        test to check if we can find a credential entry by account name and display the details of the credential
        """
        self.new_credential.save_details()
        test_credential = Credentials("Twitter","robaa38","Mfh45hfk") 
        test_credential.save_details()

        the_credential = Credentials.find_credential("Twitter")

        self.assertEqual(the_credential.account,test_credential.account)
Exemplo n.º 5
0
def login_user(username, password):
    """
    function that checks whether a user exist .
    """

    check_user = Credentials.verify_user(username, password)
    return check_user
Exemplo n.º 6
0
def copy_password(account):
    """
    A funct that copies the password using the pyperclip framework
   
    """
    return Credentials.copy_password(account)
Exemplo n.º 7
0
def generate_Password():
    '''
    generates a random password for the user.
    '''
    auto_password = Credentials.generatePassword()
    return auto_password
Exemplo n.º 8
0
def check_credendtials(account):
    """
    Function that check if a Credentials exists with that account name and return true or false

    """
    return Credentials.if_credential_exist(account)
Exemplo n.º 9
0
def find_credential(account):
    """
    Function that finds a Credentials by an account name and returns the Credentials that belong to that account
    """
    return Credentials.find_credential(account)
Exemplo n.º 10
0
def display_accounts_details():
    """
    Function that returns all the saved credential.
    """
    return Credentials.display_credentials()
Exemplo n.º 11
0
def create_new_credential(account, userName, password):
    """
    Function that creates new credentials 
    """
    new_credential = Credentials(account, userName, password)
    return new_credential
Exemplo n.º 12
0
    def setUp(self):
        """
        Method that runs before each individual credentials test methods run.

        """
        self.new_credential = Credentials('Gmail','robaa38','yx5Gij43')
Exemplo n.º 13
0
class TestCredentials(unittest.TestCase):
    """
    A test class that defines test cases for credentials class

    """ 
    def setUp(self):
        """
        Method that runs before each individual credentials test methods run.

        """
        self.new_credential = Credentials('Gmail','robaa38','yx5Gij43')
    def test_init(self):
        """
        Test case to check if a new Credentials instance has been initialized correctly
        """
        self.assertEqual(self.new_credential.account,'Gmail')
        self.assertEqual(self.new_credential.userName,'robaa38')
        self.assertEqual(self.new_credential.password,'yx5Gij43')

    def save_credential_test(self):
        """
        test case to test if the crential object is saved into the credentials list.

        """
        self.new_credential.save_details()
        self.assertEqual(len(Credentials.credentials_list),1)

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

    def test_save_many_accounts(self):
        '''
        test to check if we can save multiple credentials objects to our credentials list
        '''
        self.new_credential.save_details()
        test_credential = Credentials("Twitter","robaa38","Mfh45hfk") 
        test_credential.save_details()
        self.assertEqual(len(Credentials.credentials_list),2)

    def test_delete_credential(self):
        """
        test method to test if we can remove an account credentials from our credentials_list
        """
        self.new_credential.save_details()
        test_credential = Credentials("Twitter","robaa38","Mfh45hfk")
        test_credential.save_details()

        self.new_credential.delete_credentials()
        self.assertEqual(len(Credentials.credentials_list),1)

    def test_find_credentialr(self):
        """
        test to check if we can find a credential entry by account name and display the details of the credential
        """
        self.new_credential.save_details()
        test_credential = Credentials("Twitter","robaa38","Mfh45hfk") 
        test_credential.save_details()

        the_credential = Credentials.find_credential("Twitter")

        self.assertEqual(the_credential.account,test_credential.account)

    def test_credential_exist(self):
        """
        test to check if we can return a true or false based on whether we find or can't find the credential.
        """
        self.new_credential.save_details()
        the_credential = Credentials("Twitter", "robaa38", "Mfh45hfk")  
        the_credential.save_details()
        credential_is_found = Credentials.if_credential_exist("Twitter")
        self.assertTrue(credential_is_found)

    def test_display_all_saved_credentials(self):
        '''
        method that displays all the credentials that has been saved by the user
        '''

        self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)
Exemplo n.º 14
0
    def test_display_all_saved_credentials(self):
        '''
        method that displays all the credentials that has been saved by the user
        '''

        self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)