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)
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_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 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
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 search2_social_media(social_media): return Credential.search_social_media(social_media)
def credential_exists(social_media): return Credential.credential_exists(social_media)
def display_credentials(): ''' Display credentials saved by user ''' return Credential.display_credentials()
def save_credential(credential): Credential.save_credentials(credential)
def authenticate_user(firstname, password): ''' To verify user is enabled ''' confirm_user = Credential.confirm_user(firstname, password) return confirm_user
def setUp(self): ''' Function to create social media account credentials before each test ''' self.new_credential = Credential('clarke', 'instagram', 'kent', 'clarkekent')
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)