def test_save_multiple_account(self): ''' test ability to save more than one credentials ''' self.new_credential.save_account() test_account = Credentials("whatsapp", "password456") test_account.save_account() self.assertEqual(len(Credentials.credential_list), 2)
class TestCredentials(unittest.TestCase): ''' test for Credential ''' def setUp(self): ''' test setup method ''' self.new_credential = Credentials("twitter", "password123") def test_init(self): ''' test initilalization ''' self.assertEqual(self.new_credential.account_name, "twitter") self.assertEqual(self.new_credential.account_password, "password123") def test_save_account(self): ''' test to see if new credentials are saved in our credential_list ''' self.new_credential.save_account() self.assertEqual(len(Credentials.credential_list), 1) def tearDown(self): ''' clear our credential_list ''' Credentials.credential_list = [] def test_save_multiple_account(self): ''' test ability to save more than one credentials ''' self.new_credential.save_account() test_account = Credentials("whatsapp", "password456") test_account.save_account() self.assertEqual(len(Credentials.credential_list), 2)