예제 #1
0
    def setUp(self):
        """
        Method that runs before each individual details test methods run.

        """
        self.new_detail = Details('Facebook', 'KilewaGeorge',
                                  'StAiGhTOrSyoki@#@&')
예제 #2
0
 def test_save_many_accounts(self):
     '''
     test to check if we can save multiple details objects to our details list
     '''
     self.new_detail.save_details()
     test_detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
     test_detail.save_details()
     self.assertEqual(len(Details.details_list), 2)
예제 #3
0
 def test__detail_exist(self):
     """
     test to check if we can return a true or false based on whether we find or can't find the detail.
     """
     self.new_detail.save_details()
     the__detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
     the__detail.save_details()
     detail_is_found = Details.if_detail_exist("Twitter")
     self.assertTrue(detail_is_found)
예제 #4
0
    def test_delete_detail(self):
        """
        test method to test if we can remove an account details from our details_list
        """
        self.new_detail.save_details()
        test_detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
        test_detail.save_details()

        self.new_detail.delete_details()
        self.assertEqual(len(Details.details_list), 1)
예제 #5
0
    def test_find_details(self):
        """
        test to check if we can find a detail entry by account name and display the details.
        """
        self.new_detail.save_details()
        test_detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
        test_detail.save_details()

        the_detail = Details.find_details("Twitter")

        self.assertEqual(the_detail.account, test_detail.account)
예제 #6
0
def copy_password(account):
    """
    A funct that copies the password using the pyperclip framework
    We import the framework then declare a function that copies the emails.
    """
    return Details.copy_password(account)
예제 #7
0
def check_details(account):
    """
    Function that check if a detail exists with that account name and return true or false

    """
    return Details.if_detail_exist(account)
예제 #8
0
def find_detail(account):
    """
    Function that finds a details by an account name and returns the details that belong to that account
    """
    return Details.find_details(account)
예제 #9
0
def display_accounts_details():
    """
    Function that returns all the saved details.
    """
    return Details.display_details()
예제 #10
0
def create_new_detail(account,userName,password):
    """
    Function that creates new details for a given user account
    """
    new_detail = Details(account,userName,password)
    return new_detail
예제 #11
0
def login_user(username,password):
    """
    function that checks whether a user exist and then login the user in.
    """
    check_user = Details.verify_user(username,password)
    return check_user
예제 #12
0
class TestDetails(unittest.TestCase):
    """
    A test class that defines test cases for details class

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

        """
        self.new_detail = Details('Facebook', 'KilewaGeorge',
                                  'StAiGhTOrSyoki@#@&')

    def test_init(self):
        """
        Test case to check if a new Details instance has been initialized correctly
        """
        self.assertEqual(self.new_detail.account, 'Facebook')
        self.assertEqual(self.new_detail.userName, 'KilewaGeorge')
        self.assertEqual(self.new_detail.password, 'StAiGhTOrSyoki@#@&')

    def save_detail_test(self):
        """
        test case to test if the detail object is saved into the details list.

        """
        self.new_detail.save_details()
        self.assertEqual(len(Details.details_list), 1)

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

    def test_save_many_accounts(self):
        '''
        test to check if we can save multiple details objects to our details list
        '''
        self.new_detail.save_details()
        test_detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
        test_detail.save_details()
        self.assertEqual(len(Details.details_list), 2)

    def test_delete_detail(self):
        """
        test method to test if we can remove an account details from our details_list
        """
        self.new_detail.save_details()
        test_detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
        test_detail.save_details()

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

    def test_find_details(self):
        """
        test to check if we can find a detail entry by account name and display the details.
        """
        self.new_detail.save_details()
        test_detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
        test_detail.save_details()

        the_detail = Details.find_details("Twitter")

        self.assertEqual(the_detail.account, test_detail.account)

    def test__detail_exist(self):
        """
        test to check if we can return a true or false based on whether we find or can't find the detail.
        """
        self.new_detail.save_details()
        the__detail = Details("Twitter", "georgekilewa", "GeO%$#85Hj")
        the__detail.save_details()
        detail_is_found = Details.if_detail_exist("Twitter")
        self.assertTrue(detail_is_found)

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

        self.assertEqual(Details.display_details(), Details.details_list)
예제 #13
0
    def test_display_all_saved_details(self):
        '''
        method that displays all the details that has been saved by the user
        '''

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