def test_save_many_accounts(self): """ Test case to check if we have multiple credential objects in our credential list """ self.new_credential.save_details() test_credential = Credentials("Twitter","mahan-noor","Cfhu56g") test_credential.save_details() self.assertEqual(len(Credentials.credentials_list)2)
def test_save_many_accounts(self): ''' test to check if we can save multiple credentials objects to our credentials list ''' self.new_credential.save_details() test_credential = Credentials("Twitter", "Meshack", "nWtop67Nots") test_credential.save_details() self.assertEqual(len(Credentials.credentials_list), 2)
def test_save_many_accounts(self): ''' test to check if we can save multiple credentials objects to our credentials list ''' self.new_credential.save_details() test_credential = Credentials("Twitter","@hashisomadavid","Mfh45hfk") test_credential.save_details() self.assertEqual(len(Credentials.credentials_list),2)
def test_save_multiple_accounts(self): ''' test checks if we can save multiple credential objects to our contact list ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() self.assertEqual(len(Credentials.credentials_list), 2)
def test_credential_exist(self): """ test to check if we can return a true or false based on whether we find or can't find the credential. """ self.new_credential.save_details() the_credential = Credentials("Twitter", "@hashisomadavid", "Mfh45hfk") the_credential.save_details() credential_is_found = Credentials.if_credential_exist("Twitter") self.assertTrue(credential_is_found)
def test_credential_exist(self): """ Test to see return a true and false based on whether we can find or not find credential """ self.new_credential.save_details() the_credential =Credentials("Twitter","mahan-noor","Cfhu56g") the_credential.save_details() creditial_is_found = Credentials.if_credential_exist("Twitter") self.assertTrue(creditial_is_found)
def test_credential_exist(self): """ test to check if we can return a true or false based on whether we find or can't find the credential. """ self.new_credential.save_details() the_credential = Credentials("Facebook", "Jesse", "PTka3214") the_credential.save_details() credential_is_found = Credentials.if_credential_exist("Facebook") self.assertTrue(credential_is_found)
def test_delete_credential(self): """ test method to test if we can remove an account credentials from our credentials_list """ self.new_credential.save_details() test_credential = Credentials("Twitter","@hashisomadavid","Mfh45hfk") test_credential.save_details() self.new_credential.delete_credentials() self.assertEqual(len(Credentials.credentials_list),1)
def test_delete_credential(self): """ test method to test if we can remove an account credentials from our credentials_list """ self.new_credential.save_details() test_credential = Credentials("SnapTube", "Mwende", "Mfh45hfk") test_credential.save_details() self.new_credential.delete_credentials() self.assertEqual(len(Credentials.credentials_list), 1)
def test_delete_credentials(self): ''' to test if we can remove a credential from our credentials list ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() self.new_credential.delete_credentials() self.assertEqual(len(Credentials.credentials_list), 1)
def test_find_credentialr(self): """ test to check if we can find a credential entry by account name and display the details of the credential """ self.new_credential.save_details() test_credential = Credentials("Twitter","@hashisomadavid","Mfh45hfk") test_credential.save_details() the_credential = Credentials.find_credential("Twitter") self.assertEqual(the_credential.account,test_credential.account)
def test_find_credentials(self): """ test to check if we can find credential of the account name and display details of the credentials """ self.new_credential.save_details() test_credential = Credentials("Twitter","mahan-noor","Cfhu56g") test_credential.save_details() the_credential = Credentials.test_find_credentials("Twitter") self.assertEqual(the_credential.account,test_credential.account)
def test_delete(self): """ Test to check if we can delete account credential """ self.new_credential.save_details() test_credential = Credentials("Twitter","mahan-noor","Cfhu56g") test_credential.save_details() self.new_credential.delete_credentials() self.assertEqual(len(Credentials.credentials_list)1)
def test_credential_exists(self): ''' test to check if we can return a boolean if we cannot find the contact ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() credential_exists = Credentials.credential_exist("Gmail") self.assertTrue(credential_exists)
def test_find_credential(self): ''' test to check if we can find a credential by account platform and display information ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() found_credential = Credentials.find_credential("Gmail") self.assertEqual(found_credential.account_platform, test_credentials.account_platform)
class TestCredentials(unittest.TestCase): """ A test class that defines test cases for credentials class """ def setUp(self): """ Method that runs before each individual credentials test methods run. """ self.new_credential = Credentials('Gmail','davidhashisoma','yx5Gij43') def test_init(self): """ Test case to check if a new Credentials instance has been initialized correctly """ self.assertEqual(self.new_credential.account,'Gmail') self.assertEqual(self.new_credential.userName,'davidhashisoma') self.assertEqual(self.new_credential.password,'yx5Gij43') def save_credential_test(self): """ test case to test if the crential object is saved into the credentials list. """ self.new_credential.save_details() self.assertEqual(len(Credentials.credentials_list),1) def tearDown(self): ''' method that does clean up after each test case has run. ''' Credentials.credentials_list = [] def test_save_many_accounts(self): ''' test to check if we can save multiple credentials objects to our credentials list ''' self.new_credential.save_details() test_credential = Credentials("Twitter","@hashisomadavid","Mfh45hfk") test_credential.save_details() self.assertEqual(len(Credentials.credentials_list),2) def test_delete_credential(self): """ test method to test if we can remove an account credentials from our credentials_list """ self.new_credential.save_details() test_credential = Credentials("Twitter","@hashisomadavid","Mfh45hfk") test_credential.save_details() self.new_credential.delete_credentials() self.assertEqual(len(Credentials.credentials_list),1) def test_find_credentialr(self): """ test to check if we can find a credential entry by account name and display the details of the credential """ self.new_credential.save_details() test_credential = Credentials("Twitter","@hashisomadavid","Mfh45hfk") test_credential.save_details() the_credential = Credentials.find_credential("Twitter") self.assertEqual(the_credential.account,test_credential.account) def test_credential_exist(self): """ test to check if we can return a true or false based on whether we find or can't find the credential. """ self.new_credential.save_details() the_credential = Credentials("Twitter", "@hashisomadavid", "Mfh45hfk") the_credential.save_details() credential_is_found = Credentials.if_credential_exist("Twitter") self.assertTrue(credential_is_found) def test_display_all_saved_credentials(self): ''' method that displays all the credentials that has been saved by the user ''' self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)
class TestCredentials(unittest.TestCase): ''' Test class that defines test cases for Credentials class behaviors Args: unittest.TestCase: TestCase class that helps in creating test cases ''' def setUp(self): ''' Set Up method to run before each test case" ''' self.new_credential = Credentials("Instagram", "EssyMwangi", "Sonnie/1") def test__init(self): ''' test__init test case to test if the object is initialized properly ''' self.assertEqual(self.new_credential.account_platform, "Instagram") self.assertEqual(self.new_credential.username, "EssyMwangi") self.assertEqual(self.new_credential.password, "Sonnie/1") def test_save_credential(self): ''' test save credentials to test if the credential object is saved into credentials list ''' self.new_credential.save_details() self.assertEqual(len(Credentials.credentials_list), 1) def tearDown(self): ''' teaddown method that does clean up after eachtest case has run ''' Credentials.credentials_list = [] def test_save_multiple_accounts(self): ''' test checks if we can save multiple credential objects to our contact list ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() self.assertEqual(len(Credentials.credentials_list), 2) def test_delete_credentials(self): ''' to test if we can remove a credential from our credentials list ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() self.new_credential.delete_credentials() self.assertEqual(len(Credentials.credentials_list), 1) def test_find_credential(self): ''' test to check if we can find a credential by account platform and display information ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() found_credential = Credentials.find_credential("Gmail") self.assertEqual(found_credential.account_platform, test_credentials.account_platform) def test_credential_exists(self): ''' test to check if we can return a boolean if we cannot find the contact ''' self.new_credential.save_details() test_credentials = Credentials("Gmail", "AshleyMwangi", "Wanjiru/1") test_credentials.save_details() credential_exists = Credentials.credential_exist("Gmail") self.assertTrue(credential_exists) def test_display_all_credentials(self): ''' method that returns a list of all credentials saved ''' self.assertEqual(Credentials.display_credentials(), Credentials.credentials_list) def test_copy_username(self): ''' Test to confirm that we are copying the username from a found credential ''' self.new_credential.save_details() Credentials.copy_username("Instagram") self.assertEqual(self.new_credential.username, pyperclip.paste())