コード例 #1
0
    def test_copy_email(self):
        '''
        Test to confirm that we are copying the email address from a found user details
        '''

        self.new_details.save_details()
        Details.copy_email("0712345678")

        self.assertEqual(self.new_details.email,pyperclip.paste())
コード例 #2
0
 def test_save_multiple_details(self):
         '''
         test_save_multiple_user details to check if we can save multiple user details
         objects to our user details_list
         '''
         self.new_details.save_details()
         test_details = Details("Test","user","0712345678","*****@*****.**") # new user details
         test_details.save_details()
         self.assertEqual(len(Details.details_list),2)
コード例 #3
0
    def test_copy_password(self):
        '''
        Test to confirm that we are copying the password from a found Details
        '''

        self.new_details.save_details()
        Details.copy_password("")

        self.assertEqual(self.new_details.password, pyperclip.paste())
コード例 #4
0
    def test_delete_details(self):
            '''
            test_delete_user details to test if we can remove a user details from our user details list
            '''
            self.new_details.save_details()
            test_details = Details("Test","user","0712345678","*****@*****.**") # new user details
            test_details.save_details()

            self.new_details.delete_details()# Deleting a user details object
            self.assertEqual(len(Details.details_list),1)
コード例 #5
0
    def test_save_multiple_details(self):
        '''
        test_save_multiple_details to check if we can save multiple contact
        objects to our contact_list
        '''

        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new detail
        test_details.save_details()
        self.assertEqual(len(Details.details_list), 2)
コード例 #6
0
    def test_delete_details(self):
        '''
            test_delete_details to test if we can remove a contact from our details list
            '''
        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new detail
        test_details.save_details()

        self.new_details.delete_details()  # Deleting a detail object
        self.assertEqual(len(Details.details_list), 1)
コード例 #7
0
    def test_details_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the details.
        '''

        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new details
        test_details.save_details()

        details_exists = Details.details_exist("")

        self.assertTrue(details_exists)
コード例 #8
0
    def test_details_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the user details.
        '''

        self.new_details.save_details()
        test_details = Details("Test","user","0711223344","*****@*****.**") # new user details
        test_details.save_details()

        details_exists = Details.details_exist("0711223344")

        self.assertTrue(details_exists)
コード例 #9
0
    def test_find_details_by_account(self):
        '''
        test to check if we can find a user details by account name and display information
        '''

        self.new_details.save_details()
        test_details = Details("Test","user","0711223344","*****@*****.**") # new user details
        test_details.save_details()

        found_details = Details.find_by_account("0711223344")

        self.assertEqual(found_details.email,test_details.email)
コード例 #10
0
    def test_find_details_by_account(self):
        '''
        test to check if we can find a details by account and display information
        '''

        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new details
        test_details.save_details()

        found_details = Details.find_by_account("")

        self.assertEqual(found_details.password, test_details.password)
コード例 #11
0
ファイル: run.py プロジェクト: Frankyegon/passwordLocker
def copy_email():
    '''
    Function that copies email of all the saved user detailss
    '''
    return Details.copy_email()
コード例 #12
0
class TestPerson(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 tearDown(self):
        '''
            tearDown method that does clean up after each test case has run.
            '''
        Details.details_list = []

    def setUp(self):
        '''
        Set up method to run before each test cases.
        '''
        self.new_details = Details("", "", "", "")  # create contact object

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

        self.assertEqual(self.new_details.firstname, "")
        self.assertEqual(self.new_details.lastname, "")
        self.assertEqual(self.new_details.account, "")
        self.assertEqual(self.new_details.password, "")

    def test_save_details(self):
        '''
        test_save_details test case to test if the contact object is saved into
         the contact list
        '''
        self.new_details.save_details()  # saving the new detail
        self.assertEqual(len(Details.details_list), 1)

    def test_save_multiple_details(self):
        '''
        test_save_multiple_details to check if we can save multiple contact
        objects to our contact_list
        '''

        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new detail
        test_details.save_details()
        self.assertEqual(len(Details.details_list), 2)

    def test_delete_details(self):
        '''
            test_delete_details to test if we can remove a contact from our details list
            '''
        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new detail
        test_details.save_details()

        self.new_details.delete_details()  # Deleting a detail object
        self.assertEqual(len(Details.details_list), 1)

    def test_find_details_by_account(self):
        '''
        test to check if we can find a details by account and display information
        '''

        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new details
        test_details.save_details()

        found_details = Details.find_by_account("")

        self.assertEqual(found_details.password, test_details.password)

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

        self.new_details.save_details()
        test_details = Details("", "", "", "")  # new details
        test_details.save_details()

        details_exists = Details.details_exist("")

        self.assertTrue(details_exists)

    def test_display_all_details(self):
        '''
        method that returns a list of all details saved
        '''

        self.assertEqual(Details.display_details(), Details.details_list)

    def test_copy_password(self):
        '''
        Test to confirm that we are copying the password from a found Details
        '''

        self.new_details.save_details()
        Details.copy_password("")

        self.assertEqual(self.new_details.password, pyperclip.paste())
コード例 #13
0
ファイル: run.py プロジェクト: Frankyegon/passwordLocker
def create_details(aname, uname, passw, email):
    '''
    Function to create a new user details
    '''
    new_details = Details(aname, uname, passw, email)
    return new_details
コード例 #14
0
 def setUp(self):
     '''
     Set up method to run before each test cases.
     '''
     self.new_details = Details("", "", "", "")  # create contact object
コード例 #15
0
def create_details(fname, lname, account, password):
    '''
    Function to create a new Details
    '''
    new_details = Details(fname, lname, account, password)
    return new_details
コード例 #16
0
def display_details():
    '''
    Function that returns all the saved details
    '''
    return Details.display_details()
コード例 #17
0
def check_existing_details(account):
    '''
    Function that check if a details exists with that account and return a Boolean
    '''
    return Details.details_exist(account)
コード例 #18
0
ファイル: run.py プロジェクト: Frankyegon/passwordLocker
def check_existing_detailss(account):
    '''
    Function that check if a user details exists with that number and return a Boolean
    '''
    return Details.details_exist(account)
コード例 #19
0
    def test_display_all_details(self):
        '''
        method that returns a list of all details saved
        '''

        self.assertEqual(Details.display_details(), Details.details_list)
コード例 #20
0
 def setUp(self):
     '''
     Set up method to run before each test cases.
     '''
     self.new_details = Details("Frankyegon","twitter","password","*****@*****.**") # create user details object
コード例 #21
0
class TestDetails(unittest.TestCase):

    '''
    Test class that defines test cases for the user details 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_details = Details("Frankyegon","twitter","password","*****@*****.**") # create user details object


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

        self.assertEqual(self.new_details.account_name,"twitter")
        self.assertEqual(self.new_details.user_name,"Frankyegon")
        self.assertEqual(self.new_details.pass_word,"password")
        self.assertEqual(self.new_details.email,"*****@*****.**")

    def test_save_details(self):
        '''
        test_save_user details test case to test if the user details object is saved into
         the user details list
        '''
        self.new_details.save_details() # saving the new user details
        self.assertEqual(len(Details.details_list),1)

# setup and class creation up here
    def tearDown(self):
            '''
            tearDown method that does clean up after each test case has run.
            '''
            Details.details_list = []


    def test_save_multiple_details(self):
            '''
            test_save_multiple_user details to check if we can save multiple user details
            objects to our user details_list
            '''
            self.new_details.save_details()
            test_details = Details("Test","user","0712345678","*****@*****.**") # new user details
            test_details.save_details()
            self.assertEqual(len(Details.details_list),2)

    # More tests above
    def test_delete_details(self):
            '''
            test_delete_user details to test if we can remove a user details from our user details list
            '''
            self.new_details.save_details()
            test_details = Details("Test","user","0712345678","*****@*****.**") # new user details
            test_details.save_details()

            self.new_details.delete_details()# Deleting a user details object
            self.assertEqual(len(Details.details_list),1)

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

        self.new_details.save_details()
        test_details = Details("Test","user","0711223344","*****@*****.**") # new user details
        test_details.save_details()

        found_details = Details.find_by_account("0711223344")

        self.assertEqual(found_details.email,test_details.email)

    def test_details_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the user details.
        '''

        self.new_details.save_details()
        test_details = Details("Test","user","0711223344","*****@*****.**") # new user details
        test_details.save_details()

        details_exists = Details.details_exist("0711223344")

        self.assertTrue(details_exists)

    def test_display_all_details(self):
        '''
        method that returns a list of all user detailss saved
        '''

        self.assertEqual(Details.display_details(),Details.details_list)

    def test_copy_email(self):
        '''
        Test to confirm that we are copying the email address from a found user details
        '''

        self.new_details.save_details()
        Details.copy_email("0712345678")

        self.assertEqual(self.new_details.email,pyperclip.paste())
コード例 #22
0
def find_details(account):
    '''
    Function that finds a details by account and returns the details
    '''
    return Details.find_by_account(account)
コード例 #23
0
ファイル: run.py プロジェクト: Frankyegon/passwordLocker
def find_details(account):
    '''
    Function that finds a user details by number and returns the user details
    '''
    return Details.find_by_account(account)