コード例 #1
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
 def test_save_multiple_accounts(self):
     '''
     test_save_multiple_account to check if we can save multiple account
     objects to our account_list
     '''
     self.new_account.save_account()
     test_account = Account("Richie", "spice", "0712345678",
                            "*****@*****.**")
     test_account.save_account()
     self.assertEqual(len(Account.account_list), 8)
コード例 #2
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
    def test_delete_contact(self):
        '''
        test_delete_account to test if we can remove a account from our account list
        '''
        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()

        self.new_account.delete_account()
        self.assertEqual(len(Account.account_list), 3)
コード例 #3
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
    def test_account_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the account.
        '''

        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()

        account_exists = Account.account_exist("0712345678")

        self.assertTrue(account_exists)
コード例 #4
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
    def test_find_account_by_number(self):
        '''
        test to check if we can find a account by phone number and display information
        '''

        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()

        found_account = Account.find_by_number("0712345678")

        self.assertEqual(found_account.email, test_account.email)
コード例 #5
0
 def setUp(self):
     self.new_credentials = User("Rovet", "facebook", "wwww45")
     self.new_account = Account("clent", "iurt45")
コード例 #6
0
class TestUser(unittest.TestCase):
    def setUp(self):
        self.new_credentials = User("Rovet", "facebook", "wwww45")
        self.new_account = Account("clent", "iurt45")

    def tearDown(self):
        User.User_list = []
        Account.account_list = []

    def test_init(self):
        """
        test init help test if the object is initialized properly
        """
        self.assertEqual(self.new_credentials.username, "rovel")
        self.assertEqual(self.new_credentials.account, "facebook")
        self.assertEqual(self.new_credentials.passwords, "wwww45")
        self.assertEqual(self.new_account.name, "clent")
        self.assertEqual(self.new_account.passright, "iurt45")

    def test_save_details(self):
        self.new_credentials.save_details()
        self.assertEqual(len(User.User_list), 1)

    def test_save_account(self):
        self.new_account.save_account()
        self.assertEqual(len(Account.account_list), 1)

    def test_multiple_saves(self):
        self.new_credentials.save_details()
        test_credential = User("kent", "twitter", "1234ae")
        test_credential.save_details()
        self.assertEqual(len(User.User_list), 2)

    def test_multiple_saves(self):
        self.new_account.save_account()
        test_account = Account("Dan", "12jt3er")
        test_account.save_account()
        self.assertEqual(len(Account.account_list), 2)

    def test_delete_credentials(self):
        self.new_credentials.save_details()
        test_credential = User("ken", "intagram", "iii111")
        test_credential.save_details()
        self.new_credentials.delete_credential()
        self.assertEqual(len(User.User_list), 1)

    def test_delete_account(self):
        self.new_account.save_account()
        test_account = Account("joice", "@12rews")
        test_account.save_account()
        self.new_account.delete_account()
        self.assertEqual(len(Account.account_list), 1)

    def test_find_credentials_by_account(self):
        self.new_credentials.save_details()
        test_credentials = User("joz", "whatsapp", "1234567@")
        test_credentials.save_details()
        found_account = User.find_by_account("whatsapp")
        self.assertEqual(found_account.passwords, test_credentials.passwords)

    def test_credentials_exists(self):
        self.new_credentials.save_details()
        test_credentials = User("me", "linkedIn", "12@12")
        test_credentials.save_details()
        credentials_exists = User.credentials_exists("linkedIn")
        self.assertTrue(credentials_exists)

    def test_display_credentials(self):
        self.assertEqual(User.display_credentials(), User.User_list)

    def test_copy_passwords(self):
        """
        this method tests coping the password to clip board
        """
        self.new_credentials.save_details()
        User.copy_passwords("facebook")
        self.assertEqual(self.new_credentials.passwords, pyperclip.paste())
コード例 #7
0
 def test_delete_account(self):
     self.new_account.save_account()
     test_account = Account("joice", "@12rews")
     test_account.save_account()
     self.new_account.delete_account()
     self.assertEqual(len(Account.account_list), 1)
コード例 #8
0
 def test_multiple_saves(self):
     self.new_account.save_account()
     test_account = Account("Dan", "12jt3er")
     test_account.save_account()
     self.assertEqual(len(Account.account_list), 2)
コード例 #9
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
    def test_display_all_accounts(self):
        '''
        method that returns a list of all accounts saved
        '''

        self.assertEqual(Account.display_account(), Account.account_list)
コード例 #10
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
class TestAccount(unittest.TestCase):
    '''
    Test class that defines test cases for the account 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_account = Account("victor", "onyango", "0700736350",
                                   "*****@*****.**")

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

        self.assertEqual(self.new_account.first_name, "victor")
        self.assertEqual(self.new_account.last_name, "onyango")
        self.assertEqual(self.new_account.phone_number, "0700736350")
        self.assertEqual(self.new_account.email, "*****@*****.**")

    def test_save_account(self):

        self.new_account.save_account()
        self.assertEqual(len(Account.account_list), 6)

    def test_save_multiple_accounts(self):
        '''
        test_save_multiple_account to check if we can save multiple account
        objects to our account_list
        '''
        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()
        self.assertEqual(len(Account.account_list), 8)

    def test_delete_contact(self):
        '''
        test_delete_account to test if we can remove a account from our account list
        '''
        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()

        self.new_account.delete_account()
        self.assertEqual(len(Account.account_list), 3)

    def test_find_account_by_number(self):
        '''
        test to check if we can find a account by phone number and display information
        '''

        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()

        found_account = Account.find_by_number("0712345678")

        self.assertEqual(found_account.email, test_account.email)

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

        self.new_account.save_account()
        test_account = Account("Richie", "spice", "0712345678",
                               "*****@*****.**")
        test_account.save_account()

        account_exists = Account.account_exist("0712345678")

        self.assertTrue(account_exists)

    def test_display_all_accounts(self):
        '''
        method that returns a list of all accounts saved
        '''

        self.assertEqual(Account.display_account(), Account.account_list)
コード例 #11
0
ファイル: user_test.py プロジェクト: vique254/Password-Locker
 def setUp(self):
     '''
     Set up method to run before each test cases.
     '''
     self.new_account = Account("victor", "onyango", "0700736350",
                                "*****@*****.**")
コード例 #12
0
ファイル: user.py プロジェクト: vique254/Password-Locker
def display_account():
    '''
    Function that returns all the saved accounts
    '''
    return Account.display_account()
コード例 #13
0
ファイル: user.py プロジェクト: vique254/Password-Locker
def create_account(fname, lname, phone, email):
    '''
    Function to create a new account
    '''
    new_account = Account(fname, lname, phone, email)
    return new_account
コード例 #14
0
ファイル: user.py プロジェクト: vique254/Password-Locker
def check_existing_account(number):
    '''
    Function that check if an account exists with that number and return a Boolean
    '''
    return Account.account_exist(number)
コード例 #15
0
ファイル: user.py プロジェクト: vique254/Password-Locker
def find_account(number):
    '''
    Function that finds an account by number and returns the account
    '''
    return Account.find_by_number(number)
コード例 #16
0
def create_account(name, passright):
    """
    creating new account
    """
    new_account = Account(name, passright)
    return new_account