コード例 #1
0
    def setUp(self):
        '''
        Set up method to run before each test cases.
        '''

        self.new_credential = Credentials("instagram", "toni_guthiga",
                                          "1234g")  # create credential object
コード例 #2
0
    def setUp(self):
        '''
        Set up method to run before each test cases.
        '''

        self.new_credentials = Credentials("twitter", "akumu_collins",
                                           "1234")  # create credential object
コード例 #3
0
 def test_generate_Password(self):
     '''
     Test to confirm that we can copy the password from a found credential
     so that we can paste it upon login into the respective account.
     '''
     self.new_credential.save_account()
     Credentials.copy_password("Linkedin")
     self.assertEqual(self.new_credential.password, pyperclip.paste())
コード例 #4
0
 def test_save_multiple_account(self):
     
     #Test case to test if we can save multiple credential objects.
     
     self.new_credential.save_account()
     test_account = Credentials("Facebook","karimikim","ckk")
     test_account.save_account()
     self.assertEqual(len(Credentials.credential_list),2)
コード例 #5
0
 def test_save_multiple_account(self):
     """
     Test case to test if we can save multiple credential objects.
     """
     self.new_credential.save_account()
     test_account = Credentials("Twitter", "jgovish", "tw89")
     test_account.save_account()
     self.assertEqual(len(Credentials.credential_list), 2)
コード例 #6
0
 def test_save_multiple_credential(self):
     '''
     test_save_multiple_credential to check if we can save multiple credential objects to our credential_list
     '''
     self.new_credential.save_credential()
     test_credential = Credentials("facebook", "toniguthiga",
                                   "1122g")  # new credential
     test_credential.save_credential()
     self.assertEqual(len(Credentials.credential_list), 2)
コード例 #7
0
 def test_delete_account(self):
         '''
         test_delete_account to test if we can remove a credential from our Credentials list
         '''
         self.new_credential.save_account()
         test_credential = Credentials("Linkedin", "EmmanuelMuchiri", "EVK£mm6bP")  # new credential
         test_credential.save_account()
         self.new_credential.delete_account()  # Deleting a credential object
         self.assertEqual(len(Credentials.credentials_list), 1)
コード例 #8
0
 def test_find_site(self):
     '''
     Test to check if the find_site methods returns the correct credentials
     '''
     self.new_credentials.save_password()
     snapchat = Credentials("snapchat", "Berylzz", "1234")
     snapchat.save_password()
     credential_exists = (Credentials.find_site('snapchat'))
     self.assertEqual(credential_exists, snapchat)
コード例 #9
0
 def test_save_multiple_accounts(self):
         '''
         test_save_multiple_accounts to check if we can save multiple credential
         objects to our Credentials_list
         '''
         self.new_credential.save_account()
         test_credential = Credentials(
             "Linkedin", "EmmanuelMuchiri", "EVK£mm6bP")  # new credential
         test_credential.save_account()
         self.assertEqual(len(Credentials.credentials_list), 2)
コード例 #10
0
    def test_delete_account(self):
        """
        Test case to test if we can remove an account from credential list.
        """
        self.new_credential.save_account()
        test_credential = Credentials("instagram", "puppah", "4452ks")
        test_credential.save_account()

        self.new_credential.delete_account()

        self.assertEqual(len(Credentials.credential_list), 1)
コード例 #11
0
    def test_delete_account(self):
        '''
        test_delete_account to test if we can remove a credential from our credential list
        '''
        self.new_credential.save_credential()
        test_credential = Credentials("instagram", "toni_guthiga",
                                      "1234g")  # new credential
        test_credential.save_credential()

        self.new_credential.delete_credential()  # Deleting a credential object
        self.assertEqual(len(Credentials.credential_list), 1)
コード例 #12
0
    def test_delete_account(self):
        
        #Test case to test if we can remove an account from credential list.
        
        self.new_credential.save_account()
        test_credential = Credentials("snapchat","kim","ckk123")
        test_credential.save_account()

        self.new_credential.delete_account()

        self.assertEqual(len(Credentials.credential_list),1)
コード例 #13
0
    def test_credential_exist(self):
            '''
            test to check if we can return a Boolean  if we cannot find the credential.
            '''
            self.new_credential.save_account()
            test_credential = Credentials(
                "Linkedin", "EmmanuelMuchiri", "EVK£mm6bP")  # new credential
            test_credential.save_account()

            credential_exists = Credentials.credential_exist("Linkedin")

            self.assertTrue(credential_exists)
コード例 #14
0
    def test_save_multiple_credentials(self):
        '''
        Test_save_multiple_credentials to check if we can save multiple credential objects to our credential_list
        '''

        self.new_credentials.save_credentials()

        test_credentials = Credentials("twitter", "akumu_collins",
                                       "1234")  # new credential
        test_credentials.save_credentials()

        self.assertEqual(len(Credentials.credentials_list), 2)
コード例 #15
0
    def test_delete_credentials(self):
        """
        Test to delete account credentials
        """

        self.new_credentials.save_credentials()

        test_credentials = Credentials("twitter", "akumu_collins",
                                       "1234")  # new credential
        test_credentials.save_credentials()

        self.new_credentials.delete_credentials()
        self.assertEqual(len(Credentials.credentials_list), 1)
コード例 #16
0
 def test_display_credentials(self):
     '''
     Test to check if the display credentials methods displays all saved credentials
     '''
     self.new_credentials.save_password()
     twitter = Credentials('Twitter', 'berrypondis', '12345')
     twitter.save_password()
     gmail = Credentials('Gmail', 'hoodrat', '123456')
     gmail.save_password()
     self.assertEqual(len(Credentials.display_passwords()), 3)
コード例 #17
0
    def test_find_credentials_by_name(self):
        '''
        test to check if we can find a user or credential by account name and display information
        '''

        self.new_credentials.save_credentials()
        test_credentials = Credentials("twitter", "akumu_collins",
                                       "1234")  # new credential

        test_credentials.save_credentials()
        found_credentials = Credentials.find_by_name("twitter")

        self.assertEqual(found_credentials.default_username,
                         test_credentials.default_username)
コード例 #18
0
    def test_credentials_exists(self):
        '''
        Test to check if we can return a Boolean  if we cannot find the credential.
        '''

        self.new_credentials.save_credentials()

        test_credentials = Credentials("twitter", "akumu_collins",
                                       "1234")  # new credential
        test_credentials.save_credentials()

        credentials_exists = Credentials.credentials_exists("twitter")

        self.assertTrue(credentials_exists)
コード例 #19
0
    def test_search_credential(self):
            '''
            test to check if we can find a credential by account_name and display credentials information
            '''

            self.new_credential.save_account()
            test_credential = Credentials(
                "Linkedin", "EmmanuelMuchiri", "EVK£mm6bP")  # new credential
            test_credential.save_account()

            found_credential = Credentials.search_credential("Linkedin")

            self.assertEqual(found_credential.account_name,
                             test_credential.account_name)
コード例 #20
0
ファイル: run.py プロジェクト: tonyguthiga/password-locker
def login_user(user_name, password):
    '''
    Function to see if user exist and allow them to login
    '''

    check_user_exist = Credentials.check_user_exist(user_name, password)
    return check_user_exist
コード例 #21
0
def create_credential(account_name,account_username,account_password):
    '''
    Function to create a new credential
    '''

    new_credential = Credentials(account_name,account_username,account_password)
    return new_credential
コード例 #22
0
    def test_display_credential(self):
        '''
        method that returns a list of all credentials saved
        '''

        self.assertEqual(Credentials.display_credential(),
                         Credentials.credential_list)
コード例 #23
0
 def test_display_credentials(self):
     '''
     Test to confrim that we can actually display credential(s) from credentials_list
     that the user has and all the information.i.e account name username(S) and password(s)
     '''
     self.assertEqual(Credentials.display_credentials(),
                      Credentials.credentials_list)
コード例 #24
0
def create_credential(account_Name, user_Name, user_Password):
    """
    Function to create a new Credentials
    """
    new_credential = Credentials(account_Name, user_Name,
                                 user_Password)  # create Credentials object
    return new_credential
コード例 #25
0
def generate_password():

    #Function that generates random password.

    password_gen = Credentials.generate_password()

    return password_gen
コード例 #26
0
ファイル: run.py プロジェクト: Akumucollins/Password_Locker
def add_credentials(default_accname, default_username, default_password):
    """
    Function to add a new account and its credentials
    """
    new_credentials = Credentials(default_accname, default_username,
                                  default_password)
    return new_credentials
コード例 #27
0
def authenticate_User(us_name, pwd):
    '''
    This function authenticates the current user
    in our application
    '''
    authentic_user = Credentials.confirm_User(us_name, pwd)

    return authentic_user
コード例 #28
0
class TestCredentials(unittest.TestCase):
    
    #Test that define test cases for credentials.
    
    def setUp(self):
        
        #set up method to run before each test cases
        
        self.new_credential = Credentials("instagram","karimi_kim", "kim")

    def test_init(self):
        
        #Test case to test if the object is initialized properly.
        

        self.assertEqual(self.new_credential.account_name,"instagram")
        self.assertEqual(self.new_credential.account_username,"karimi_kim")
        self.assertEqual(self.new_credential.account_password,"kim")
    
    def tearDown(self):
        Credentials.credential_list = []

    def test_save_account(self):
        
        #Test case to test if the credential object is saved in to credential_list.
        
        self.new_credential.save_account()
        self.assertEqual(len(Credentials.credential_list), 1)

    def test_save_multiple_account(self):
        
        #Test case to test if we can save multiple credential objects.
        
        self.new_credential.save_account()
        test_account = Credentials("Facebook","karimikim","ckk")
        test_account.save_account()
        self.assertEqual(len(Credentials.credential_list),2)

    def test_delete_account(self):
        
        #Test case to test if we can remove an account from credential list.
        
        self.new_credential.save_account()
        test_credential = Credentials("snapchat","kim","ckk123")
        test_credential.save_account()

        self.new_credential.delete_account()

        self.assertEqual(len(Credentials.credential_list),1)

    def test_display_accounts(self):
        
        #Test case to test if lists of accounts are displayed.
        
        self.assertEqual(Credentials.display_accounts(),Credentials.credential_list)
コード例 #29
0
class TestCredentials(unittest.TestCase):
    def setUp(self):
        '''
        Set up method to run before  each test
        '''
        self.new_credentials = Credentials("Snapchat", "Berylzz", "1234")

    def tearDown(self):
        '''
         Tear down method performs clean up after each test method completes
        '''
        Credentials.passwords = []

    def test__init__(self):
        '''
        Test to check if initialization has been done
        '''
        self.assertEqual(self.new_credentials.site, "Snapchat")
        self.assertEqual(self.new_credentials.user_name, "Berylzz")
        self.assertEqual(self.new_credentials.password, "1234")

    def test_save_passwords(self):
        '''
        Test to check if the new credential info is saved into the credentials list
        '''
        self.new_credentials.save_password()
        self.assertEqual(len(Credentials.passwords), 1)

    def test_find_site(self):
        '''
        Test to check if the find_site methods returns the correct credentials
        '''
        self.new_credentials.save_password()
        snapchat = Credentials("snapchat", "Berylzz", "1234")
        snapchat.save_password()
        credential_exists = (Credentials.find_site('snapchat'))
        self.assertEqual(credential_exists, snapchat)

    def test_display_credentials(self):
        '''
        Test to check if the display credentials methods displays all saved credentials
        '''
        self.new_credentials.save_password()
        twitter = Credentials('Twitter', 'berrypondis', '12345')
        twitter.save_password()
        gmail = Credentials('Gmail', 'hoodrat', '123456')
        gmail.save_password()
        self.assertEqual(len(Credentials.display_passwords()), 3)
コード例 #30
0
ファイル: run.py プロジェクト: tonyguthiga/password-locker
def display_credential():
    '''
    Function to return all saved credentials
    '''

    return Credentials.display_credential()