def test_save_many_accounts(self): """ saving multiple accounts """ self.new_account.save_account() test_account = Credentilas("Fly", "fly123", "123") test_account.save_account() self.assertEqual(len(Credentilas.account_list), 2)
def test_delete_account(self): """ deleting account details """ self.new_account.save_account() test_account = Credentilas("Fly", "fly123", "123") test_account.save_account() self.new_account.delete_account() self.assertEqual(len(Credentilas.account_list), 1)
class TestCredentials(unittest.TestCase): def setUp(self): """ method to run before each test """ self.new_account = Credentilas("Fly", "fly123", "123") def tearDown(self): """ tearDown method that does clean up after each case has run. """ Credentilas.account_list = [] def test_init(self): """ test_init test case to test if the object is initialized properly """ self.assertEqual(self.new_account.sitename, "Fly") self.assertEqual(self.new_account.accountname, "fly123") self.assertEqual(self.new_account.password, "123") def test_save_account(self): """ saving account details """ self.new_account.save_account() self.assertEqual(len(Credentilas.account_list), 1) def test_save_many_accounts(self): """ saving multiple accounts """ self.new_account.save_account() test_account = Credentilas("Fly", "fly123", "123") test_account.save_account() self.assertEqual(len(Credentilas.account_list), 2) def test_delete_account(self): """ deleting account details """ self.new_account.save_account() test_account = Credentilas("Fly", "fly123", "123") test_account.save_account() self.new_account.delete_account() self.assertEqual(len(Credentilas.account_list), 1) def test_display_credentials(self): """ displaying credentials """ self.assertEqual(Credentilas.display_account(), Credentilas.account_list)
def test_display_credentials(self): """ displaying credentials """ self.assertEqual(Credentilas.display_account(), Credentilas.account_list)
def setUp(self): """ method to run before each test """ self.new_account = Credentilas("Fly", "fly123", "123")
def display_account_details(): """ displays saved account details """ return Credentilas.display_account()
def create_account(sitename, accountname, password): """ creating account details """ new_account = Credentilas(sitename, accountname, password) return new_account