예제 #1
0
    def test_save_details(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Joe','Facebook','Benny','test01')
        facebook.save_details()
        self.assertEqual(len(Details.details_list),2)
 def test_find_my_website_name(self):
     '''
     Test case to test if we can search credential by site_name and return the correct credential.
     '''
     self.new_detail.save_detail()
     twitter = Details('Bill', 'Twitter', 'billy', 'billyboss')
     twitter.save_detail()
     detail_exist = Details.find_my_website_name('Twitter')
     self.assertEqual(detail_exist, twitter)
예제 #3
0
    def test_find_by_site_name(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Ben','Facebook','Benny','test01')
        facebook.save_details()
        details_exists = Details.find_by_site_name('Facebook')
        self.assertEqual(details_exists,facebook)
 def test_save_details(self):
     '''
     Test case to check if we can save details to the details list.
     '''
     self.new_detail.save_detail()
     instagram = Details("Deyalasoul", "Instagram", "Deyala",
                         "Roseflower01")
     instagram.save_detail()
     self.assertEqual(len(Details.details_list), 2)
    def test_delete_detail(self):
        '''
        Test to see if we can delete a saved detail
        '''
        self.new_detail.save_detail()
        new_detail = Details('Bill', 'Twitter', 'billy', 'billyboss')
        new_detail.save_detail()

        self.new_detail.del_detail()
        self.assertEqual(len(Details.details_list), 1)
    def test_credential_exists(self):
        '''
        Test case to confirm if a detail exist in the detail_list.
        '''
        self.new_detail.save_detail()
        test_detail = Details('Bill', 'Twitter', 'billy', 'billyboss')
        test_detail.save_detail()

        detail_exists = Details.detail_exist("Twitter")
        self.assertTrue(detail_exists)
 def test_display_details(self):
     '''
     Test case to test if objects show.
     '''
     self.new_detail.save_detail()
     instagram = Details("Deyalasoul", "Instagram", "Deyala",
                         "Roseflower01")
     instagram.save_detail()
     twitter = Details('Bill', 'Twitter', 'billy', 'billyboss')
     twitter.save_detail()
     self.assertEqual(len(Details.display_detail(instagram.user_name)), 1)
예제 #8
0
def verify_user(fname, password):
    '''
    verify if there is already a user before adding details
    '''

    checking_user = Details.check_user(fname, password)
    return checking_user
예제 #9
0
    def test_display_details(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Ben','Facebook','Benny','test01')
        facebook.save_details()
        twitter = Details('Ben','Twitter','Benny','test01')
        twitter.save_details()
 def test_copy_details(self):
     '''
     Test casse to test if the copy detail function copies the correct detail of the user.
     '''
     self.new_detail.save_detail()
     facebook = Details('Dolphine', 'Facebook', 'dalphine', 'atieno1997')
     facebook.save_detail()
     find_detail = None
     for detail in Details.users_details_list:
         find_detail = Details.find_my_website_name(detail.website_name)
         pyperclip.copy(find_detail.password)
     Details.copy_detail(self.new_detail.website_name)
     self.assertEqual('atieno1997', pyperclip.paste())
예제 #11
0
    def test_check_user(self):
        '''
        checking if the user credentials works
        '''
        self.n_user = User('Ben','Jackson','test01')
        self.n_user.save_user_details()

        user2 = User('Joe','Jackson','test01')
        user2.save_user_details()

        for user in User.users_list:
            if user.f_name == user2.f_name and user.password == user2.password:
                current_user = user.f_name
        return current_user

        self.assertEqual(current_user,Details.check_user(user2.password,user2.f_name))
예제 #12
0
    def test_copy_details(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Ben','Facebook','Benny','test01')
        facebook.save_details()
        find_details = None
        for details in Details.user_details_list:
            find_details=Details.find_by_site_name(details.site)
            return pyperclip.copy(find_details.password)
        Details.copy_details(self.new_details.site)
        self.assertEqual('test01',pyperclip.paste())
        print(pyperclip.paste())
예제 #13
0
def copy_detail(website_name):
    '''
    Function that copies credentials details to the clipboard.
    '''
    return Details.copy_detail(website_name)
예제 #14
0
def display_details(username):
    '''
    Fucntion to display details saved.
    '''
    return Details.display_detail(username)
예제 #15
0
def save_detail(detail):
    '''
    Function to save a new created detail.
    '''
    Details.save_detail(detail)
예제 #16
0
def create_detail(user_name, website_name, account_name, password):
    '''
    Function creates new user details.
    '''
    new_detail = Details(user_name, website_name, account_name, password)
    return new_detail
예제 #17
0
def generate_password(self):
    '''
    function enables user to generate password.
    '''
    gen_password = Details.generate_password(self)
    return gen_password
예제 #18
0
def create_detail(username, site, account, password):
    '''
    create new user details
    '''
    new_details = Details(username, site, account, password)
    return new_details
 def setUp(self):
     '''
     set up method to run before each test cases.
     '''
     self.new_detail = Details("Dolphine", "Facebook", "dalphine",
                               "atieno1997")
class TestDetails(unittest.TestCase):
    '''
    Test class that defines test cases for the credentials 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_detail = Details("Dolphine", "Facebook", "dalphine",
                                  "atieno1997")

    def test__init__(self):
        '''
        Test case to check if details created is properly done.
        '''
        self.assertEqual(self.new_detail.user_name, "Dolphine")
        self.assertEqual(self.new_detail.website_name, "Facebook")
        self.assertEqual(self.new_detail.account_name, "dalphine")
        self.assertEqual(self.new_detail.password, "atieno1997")

    def tearDown(self):
        '''
        This method clears users details after every test.
        '''
        Details.details_list = []

    def test_save_details(self):
        '''
        Test case to check if we can save details to the details list.
        '''
        self.new_detail.save_detail()
        instagram = Details("Deyalasoul", "Instagram", "Deyala",
                            "Roseflower01")
        instagram.save_detail()
        self.assertEqual(len(Details.details_list), 2)

    def test_display_details(self):
        '''
        Test case to test if objects show.
        '''
        self.new_detail.save_detail()
        instagram = Details("Deyalasoul", "Instagram", "Deyala",
                            "Roseflower01")
        instagram.save_detail()
        twitter = Details('Bill', 'Twitter', 'billy', 'billyboss')
        twitter.save_detail()
        self.assertEqual(len(Details.display_detail(instagram.user_name)), 1)

    def test_find_my_website_name(self):
        '''
        Test case to test if we can search credential by site_name and return the correct credential.
        '''
        self.new_detail.save_detail()
        twitter = Details('Bill', 'Twitter', 'billy', 'billyboss')
        twitter.save_detail()
        detail_exist = Details.find_my_website_name('Twitter')
        self.assertEqual(detail_exist, twitter)

    def test_copy_details(self):
        '''
        Test casse to test if the copy detail function copies the correct detail of the user.
        '''
        self.new_detail.save_detail()
        facebook = Details('Dolphine', 'Facebook', 'dalphine', 'atieno1997')
        facebook.save_detail()
        find_detail = None
        for detail in Details.users_details_list:
            find_detail = Details.find_my_website_name(detail.website_name)
            pyperclip.copy(find_detail.password)
        Details.copy_detail(self.new_detail.website_name)
        self.assertEqual('atieno1997', pyperclip.paste())

    def test_delete_detail(self):
        '''
        Test to see if we can delete a saved detail
        '''
        self.new_detail.save_detail()
        new_detail = Details('Bill', 'Twitter', 'billy', 'billyboss')
        new_detail.save_detail()

        self.new_detail.del_detail()
        self.assertEqual(len(Details.details_list), 1)

    def test_credential_exists(self):
        '''
        Test case to confirm if a detail exist in the detail_list.
        '''
        self.new_detail.save_detail()
        test_detail = Details('Bill', 'Twitter', 'billy', 'billyboss')
        test_detail.save_detail()

        detail_exists = Details.detail_exist("Twitter")
        self.assertTrue(detail_exists)
예제 #21
0
def display_details(username):
    '''
    display saved user details
    '''
    return Details.display_details(username)
예제 #22
0
def copy_details(site):
    '''
    copy all details to clipboard
    '''
    return Details.copy_details(site)
예제 #23
0
def new_password():
    '''
    automatic random password generator
    '''
    passcode = Details.new_password()
    return passcode
예제 #24
0
class TestDetails(unittest.TestCase):
    '''
    test for user credentials

    Args:
        unittest.TestCase: it creates test cases
    '''

    # Test three
    def test_check_user(self):
        '''
        checking if the user credentials works
        '''
        self.n_user = User('Ben','Jackson','test01')
        self.n_user.save_user_details()

        user2 = User('Joe','Jackson','test01')
        user2.save_user_details()

        for user in User.users_list:
            if user.f_name == user2.f_name and user.password == user2.password:
                current_user = user.f_name
        return current_user

        self.assertEqual(current_user,Details.check_user(user2.password,user2.f_name))


    def setUp(self):
        '''

        '''
        self.new_details = Details('Ben','Instagram','Benny','test01')

    def tearDown(self):
        '''

        '''
        Details.details_list = []
        User.users_list = []

    # Test four
    def test__init__(self):
        self.assertEqual(self.new_details.username, 'Ben')
        self.assertEqual(self.new_details.site, 'Instagram')
        self.assertEqual(self.new_details.account, 'Benny')
        self.assertEqual(self.new_details.password, 'test01')

    
    # Test five
    def test_save_details(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Joe','Facebook','Benny','test01')
        facebook.save_details()
        self.assertEqual(len(Details.details_list),2)

    
    # Test six
    def test_display_details(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Ben','Facebook','Benny','test01')
        facebook.save_details()
        twitter = Details('Ben','Twitter','Benny','test01')
        twitter.save_details()
        # self.assertEqual(len(Details.display_details(facebook.username)),2)

    # Test seven
    def test_find_by_site_name(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Ben','Facebook','Benny','test01')
        facebook.save_details()
        details_exists = Details.find_by_site_name('Facebook')
        self.assertEqual(details_exists,facebook)


    # Test eight
    def test_copy_details(self):
        '''

        '''
        self.new_details.save_details()
        facebook = Details('Ben','Facebook','Benny','test01')
        facebook.save_details()
        find_details = None
        for details in Details.user_details_list:
            find_details=Details.find_by_site_name(details.site)
            return pyperclip.copy(find_details.password)
        Details.copy_details(self.new_details.site)
        self.assertEqual('test01',pyperclip.paste())
        print(pyperclip.paste())
예제 #25
0
def find_my_website(website_name):
    '''
    Function that searches for a website name.
    '''
    return Details.find_my_website_name(website_name)
예제 #26
0
def save_details(details):
    '''
    save newly created detail
    '''
    Details.save_details(details)
예제 #27
0
def check_existing_details(website_name):
    '''
    Function that checks if a detail exists.
    '''
    return Details.detail_exist(website_name)
예제 #28
0
    def setUp(self):
        '''

        '''
        self.new_details = Details('Ben','Instagram','Benny','test01')