Beispiel #1
0
    def test_save_multiple_Credentials(self):

        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new contact
        test_Credentials.save_info()
        self.assertEqual(len(Credentials.Credentials_list), 2)
Beispiel #2
0
    def test_delete_credentials(self):
        '''
        test_delete_contact to test if we can remove a contact from our contact list
        '''
        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new contact
        test_Credentials.save_info()

        self.new_credential.delete_credentials()  # Deleting a contact object
        self.assertEqual(len(Credentials.Credentials_list), 1)
Beispiel #3
0
    def test_find_credentails(self):
        '''
        test to check if we can find a credentials and display information
        '''

        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new credentials
        test_Credentials.save_info()

        found_credential = Credentials.find_credentials("Instagram")

        self.assertEqual(found_credential.App, test_Credentials.App)
Beispiel #4
0
    def test_credentials_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the credentials.
        '''

        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new credentials
        test_Credentials.save_info()

        credentials_exists = Credentials.credentials_exist("Instagram")

        self.assertTrue(credentials_exists)
Beispiel #5
0
    def test_display_all_credentials(self):
        '''
        method that returns a list of all credentials saved
        '''

        self.assertEqual(Credentials.display_credentials(),
                         Credentials.Credentials_list)
Beispiel #6
0
    def setUp(self):

        self.new_credential = Credentials("Instagram", "Fred", "a1B2c3D4e")
Beispiel #7
0
class testCredentials(unittest.TestCase):
    '''
    Test class that defines test cases for the credentials class behaviours.
    '''
    def setUp(self):

        self.new_credential = Credentials("Instagram", "Fred", "a1B2c3D4e")

    def test_init(self):

        self.assertEqual(self.new_credential.App, 'Instagram')
        self.assertEqual(self.new_credential.Username, 'Fred')
        self.assertEqual(self.new_credential.Password, 'a1B2c3D4e')

    def save_credential_test(self):

        self.new_credential.save_info()
        self.assertEqual(len(Credentials.Credentials_list), 1)

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


# other test cases here

    def test_save_multiple_Credentials(self):

        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new contact
        test_Credentials.save_info()
        self.assertEqual(len(Credentials.Credentials_list), 2)

    def test_delete_credentials(self):
        '''
        test_delete_contact to test if we can remove a contact from our contact list
        '''
        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new contact
        test_Credentials.save_info()

        self.new_credential.delete_credentials()  # Deleting a contact object
        self.assertEqual(len(Credentials.Credentials_list), 1)

    def test_find_credentails(self):
        '''
        test to check if we can find a credentials and display information
        '''

        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new credentials
        test_Credentials.save_info()

        found_credential = Credentials.find_credentials("Instagram")

        self.assertEqual(found_credential.App, test_Credentials.App)

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

        self.new_credential.save_info()
        test_Credentials = Credentials("Instagram", "Fred",
                                       "a1B2c3D4e")  # new credentials
        test_Credentials.save_info()

        credentials_exists = Credentials.credentials_exist("Instagram")

        self.assertTrue(credentials_exists)

    def test_display_all_credentials(self):
        '''
        method that returns a list of all credentials saved
        '''

        self.assertEqual(Credentials.display_credentials(),
                         Credentials.Credentials_list)
Beispiel #8
0
def generate_Password():
    '''
    generates a random password for the user.
    '''
    gen_password = Credentials.generatePassword()
    return gen_password
Beispiel #9
0
def display_credentials():
    '''
    Function that returns all the saved contacts
    '''
    return Credentials.display_credentials()
Beispiel #10
0
def check_credentials(App):
    '''
    Function that check if a credential exists with that app and return a Boolean
    '''
    return Credentials.credentials_exist(App)
Beispiel #11
0
def find_credentials(App):
    '''
    Function that finds a credential by App and returns the credential
    '''
    return Credentials.find_credentials(App)
Beispiel #12
0
def create_credentials(App, Username, Password):
    '''
    Function to create new credentails
    '''
    new_credentials = Credentials(App, Username, Password)
    return new_credentials
Beispiel #13
0
def signin_user(Username, Password):
    """
    function that checks whether a user exist and then login the user in.
    """
    confirm_user = Credentials.true_user(Username, Password)
    return confirm_user