def test_find_creds(self): """ Created test to find a users credentials """ self.new_acc.save_acc() testacc4 = AccountDetails("peter123", "Gmail", "qwert123") testacc4.save_acc() found_creds = AccountDetails.find_creds("peter123") self.assertEqual(found_creds.acc_username,testacc4.acc_username)
def test_save_multiple_acc(self): """ Created test to save save multiple account to the list in a clasS AccountDetails """ self.new_acc.save_acc() test_acc= AccountDetails("samuel123","Facebook", "samuel@123" ) test_acc.save_acc() test_acc2 = AccountDetails("alvin.kyle", "Instagram", "kyle@abc") test_acc2.save_acc() self.assertEqual(len(AccountDetails.details_list), 3)
def test_delete_acc(self): """ Created test to delete account credentials """ self.new_acc.save_acc() test_acc3 = AccountDetails("hannes", "Reddit", "yoda") test_acc3.save_acc() test_acc3.delete_acc() self.assertEqual(len(AccountDetails.details_list),1)
def setUp(self): """ Set Up with dummy instance object of Account Details """ self.new_acc = AccountDetails("Sydx10", "Snapchat", "syd123")
class TestAccountDetails(unittest.TestCase): def setUp(self): """ Set Up with dummy instance object of Account Details """ self.new_acc = AccountDetails("Sydx10", "Snapchat", "syd123") def tearDown(self): """ """ AccountDetails.details_list= [] def test__init__(self): """ Created test to check if the object has actually been instansiated """ self.assertEqual(self.new_acc.acc_username,"Sydx10") self.assertEqual(self.new_acc.platform_name, "Snapchat") self.assertEqual(self.new_acc.acc_password, "syd123") def test_save_acc(self): """ Created test to check if object of Account Details is being added to a list """ self.new_acc.save_acc() self.assertEqual(len(AccountDetails.details_list), 1) def test_save_multiple_acc(self): """ Created test to save save multiple account to the list in a clasS AccountDetails """ self.new_acc.save_acc() test_acc= AccountDetails("samuel123","Facebook", "samuel@123" ) test_acc.save_acc() test_acc2 = AccountDetails("alvin.kyle", "Instagram", "kyle@abc") test_acc2.save_acc() self.assertEqual(len(AccountDetails.details_list), 3) def test_delete_acc(self): """ Created test to delete account credentials """ self.new_acc.save_acc() test_acc3 = AccountDetails("hannes", "Reddit", "yoda") test_acc3.save_acc() test_acc3.delete_acc() self.assertEqual(len(AccountDetails.details_list),1) def test_display_accs(self): """ Created test to display all account credentials for user """ self.assertEqual(AccountDetails.display_accs(), AccountDetails.details_list) def test_find_creds(self): """ Created test to find a users credentials """ self.new_acc.save_acc() testacc4 = AccountDetails("peter123", "Gmail", "qwert123") testacc4.save_acc() found_creds = AccountDetails.find_creds("peter123") self.assertEqual(found_creds.acc_username,testacc4.acc_username)
def test_display_accs(self): """ Created test to display all account credentials for user """ self.assertEqual(AccountDetails.display_accs(), AccountDetails.details_list)
def find_creds(acc_username): """ Finding account credentials """ return AccountDetails.find_creds(acc_username)
def display_accounts(): """ Display all account credentials """ return AccountDetails.display_accs()
def create_acc(acc_username, platform_name, acc_password): new_account = AccountDetails(acc_username, platform_name, acc_password) return new_account