Esempio n. 1
0
    def test_credential_exists(self):
        self.new_credential.save_credentials()
        instagram = Credential('clarke', 'instagram', 'kent', 'clarkekent')
        instagram.save_credentials()

        credential_exists = Credential.credential_exists("instagram")
        self.assertTrue(credential_exists)
Esempio n. 2
0
 def test_search_social_media(self):
     '''
     Test to confirm if the method returns the correct social media credential
     '''
     self.new_credential.save_credentials()
     instagram = Credential('clarke', 'instagram', 'kent', 'clarkekent')
     instagram.save_credentials()
Esempio n. 3
0
 def test_display_credentials(self):
     '''
     Confirm user can view correct credential details
     '''
     self.new_credential.save_credentials()
     instagram = Credential('clarke', 'instagram', 'kent', 'clarkekent')
     instagram.save_credentials()
     self.assertEqual(Credential.display_credentials(),
                      Credential.credentials_list)
Esempio n. 4
0
def create_credential(user_name, social_media, account_name, password):
    '''
    Creating new credentials
    '''
    new_credential = Credential(user_name, social_media, account_name,
                                password)
    return new_credential
Esempio n. 5
0
 def test_confirm_user(self):
     self.new_user = User('Clyde', 'Dennis', 'lit')
     self.new_user.save_user()
     userZ = User('Clyde', 'Dennis', 'lit')
     userZ.save_user()
     active_user = Credential.confirm_user('Clyde', 'lit')
     self.assertTrue(active_user)
Esempio n. 6
0
def search2_social_media(social_media):
    return Credential.search_social_media(social_media)
Esempio n. 7
0
def credential_exists(social_media):
    return Credential.credential_exists(social_media)
Esempio n. 8
0
def display_credentials():
    '''
    Display credentials saved by user
    '''
    return Credential.display_credentials()
Esempio n. 9
0
def save_credential(credential):
    Credential.save_credentials(credential)
Esempio n. 10
0
def authenticate_user(firstname, password):
    '''
    To verify user is enabled
    '''
    confirm_user = Credential.confirm_user(firstname, password)
    return confirm_user
Esempio n. 11
0
 def setUp(self):
     '''
     Function to create social media account credentials before each test
     '''
     self.new_credential = Credential('clarke', 'instagram', 'kent',
                                      'clarkekent')
Esempio n. 12
0
class TestCredentials(unittest.TestCase):
    def test_confirm_user(self):
        self.new_user = User('Clyde', 'Dennis', 'lit')
        self.new_user.save_user()
        userZ = User('Clyde', 'Dennis', 'lit')
        userZ.save_user()
        active_user = Credential.confirm_user('Clyde', 'lit')
        self.assertTrue(active_user)

    def setUp(self):
        '''
        Function to create social media account credentials before each test
        '''
        self.new_credential = Credential('clarke', 'instagram', 'kent',
                                         'clarkekent')

    def test__init__(self):
        '''
        Confirm that credential creation is as expected
        '''
        self.assertEqual(self.new_credential.user_name, 'clarke')
        self.assertEqual(self.new_credential.social_media, 'instagram')
        self.assertEqual(self.new_credential.account_name, 'kent')
        self.assertEqual(self.new_credential.password, 'clarkekent')

    def test_save_credentials(self):
        '''
        Confirm and test if the new credential info is being saved
        '''
        self.new_credential.save_credentials()
        self.assertEqual(len(Credential.credentials_list), 1)

    def tearDown(self):
        User.users_list = []
        Credential.credentials_list = []

    def test_display_credentials(self):
        '''
        Confirm user can view correct credential details
        '''
        self.new_credential.save_credentials()
        instagram = Credential('clarke', 'instagram', 'kent', 'clarkekent')
        instagram.save_credentials()
        self.assertEqual(Credential.display_credentials(),
                         Credential.credentials_list)

    def test_delete_contact(self):
        Credential.credentials_list = []

    def test_search_social_media(self):
        '''
        Test to confirm if the method returns the correct social media credential
        '''
        self.new_credential.save_credentials()
        instagram = Credential('clarke', 'instagram', 'kent', 'clarkekent')
        instagram.save_credentials()

    def test_credential_exists(self):
        self.new_credential.save_credentials()
        instagram = Credential('clarke', 'instagram', 'kent', 'clarkekent')
        instagram.save_credentials()

        credential_exists = Credential.credential_exists("instagram")
        self.assertTrue(credential_exists)