Exemple #1
0
 def test_save_multiple_users(self):
     '''
     test_save_multiple_account 
     '''
     self.new_account.add_account()
     new_account_test = Credi('Instagram', 'malcom', 'gram')
     new_account_test.add_account()
     self.assertEqual(len(Credi.account_list), 2)
Exemple #2
0
 def test_delete_account(self):
     ''' 
     This here is the to test is we can remove obbejct from list
     '''
     self.new_account.add_account()
     new_account_test = Credi('Instagram', 'malcom', 'gram')
     new_account_test.add_account()
     self.new_account.delete_account()  # Deleting obeject of the new user
     self.assertEqual(len(Credi.account_list), 1)
Exemple #3
0
    def test_find_account_exist(self):
        '''
        test to find user account and return
        '''
        self.new_account.add_account()
        new_account_test = Credi('Instagram', 'malcom', 'gram')
        new_account_test.add_account()

        account_exists = Credi.find_account_exist("malcom", "gram")

        self.assertTrue(account_exists)
Exemple #4
0
    def test_user_by_username(self):
        '''
        test to check if we can find a user by username
        '''

        self.new_account.add_account()
        new_account_test = Credi('Instagram', 'malcom', 'gram')
        new_account_test.add_account()

        account_exists = Credi.find_account("malcom", 'gram')
        '''
        we set assertEqual to compare the instance of password
        '''
        self.assertEqual(account_exists.account, new_account_test.account)
Exemple #5
0
    def test_display_all_accounts(self):
        '''
        method that returns a list of all accounts
        '''

        self.assertEqual(Credi.display_accounts(), Credi.account_list)
Exemple #6
0
 def setUp(self):
     '''
     set up method test
     '''
     self.new_account = Credi('twitter', 'ianodad', 'rettiwt')
Exemple #7
0
class TestAccount(unittest.TestCase):
    def setUp(self):
        '''
        set up method test
        '''
        self.new_account = Credi('twitter', 'ianodad', 'rettiwt')

    def test_init(self):
        '''
        intiating test for users
        '''
        self.assertEqual(self.new_account.account, "twitter")
        self.assertEqual(self.new_account.username, "ianodad")
        self.assertEqual(self.new_account.password, "rettiwt")

    def test_add_account(self):
        '''
        test_add account
        '''
        self.new_account.add_account()  # saving the new contact
        self.assertEqual(len(Credi.account_list), 1)

    def tearDown(self):
        '''
        tearDown method that does clean up after each test case has run.
        '''
        Credi.account_list = []

    def test_save_multiple_users(self):
        '''
        test_save_multiple_account 
        '''
        self.new_account.add_account()
        new_account_test = Credi('Instagram', 'malcom', 'gram')
        new_account_test.add_account()
        self.assertEqual(len(Credi.account_list), 2)

    def test_delete_account(self):
        ''' 
        This here is the to test is we can remove obbejct from list
        '''
        self.new_account.add_account()
        new_account_test = Credi('Instagram', 'malcom', 'gram')
        new_account_test.add_account()
        self.new_account.delete_account()  # Deleting obeject of the new user
        self.assertEqual(len(Credi.account_list), 1)

    def test_find_account_exist(self):
        '''
        test to find user account and return
        '''
        self.new_account.add_account()
        new_account_test = Credi('Instagram', 'malcom', 'gram')
        new_account_test.add_account()

        account_exists = Credi.find_account_exist("malcom", "gram")

        self.assertTrue(account_exists)

    def test_user_by_username(self):
        '''
        test to check if we can find a user by username
        '''

        self.new_account.add_account()
        new_account_test = Credi('Instagram', 'malcom', 'gram')
        new_account_test.add_account()

        account_exists = Credi.find_account("malcom", 'gram')
        '''
        we set assertEqual to compare the instance of password
        '''
        self.assertEqual(account_exists.account, new_account_test.account)

    def test_display_all_accounts(self):
        '''
        method that returns a list of all accounts
        '''

        self.assertEqual(Credi.display_accounts(), Credi.account_list)
Exemple #8
0
def find_account():
    '''
    check if account and return
    '''

    return Credi.find_account()
Exemple #9
0
def account_exist():
    '''
    loop throuh list to check account already there
    '''
    return Credi.find_account_exist()
Exemple #10
0
def create_new_account(account, username, password):
    '''
    create new account
    '''
    new_account = Credi(account, username, password)
    return new_account
Exemple #11
0
def display_account_info():
    '''
    check the display
    '''

    return Credi.display_accounts()