예제 #1
0
 def setUp(self):
     '''
     Set up method to run before each test case
     '''
     self.new_credential = Credentials("Lewis", "Twitter", "Lewis", "1234")
예제 #2
0
def find_credential(account):

    return Credentials.find_credential(account)
예제 #3
0
def generate_Password():

    auto_password = Credentials.generatePassword()
    return auto_password
예제 #4
0
 def setUp(self):
     '''
     method to run before and after each test 
     '''
     self.new_credential = Credentials("vperry", "twitter", "xyz")
예제 #5
0
def create_new_credential(account, userName, password):

    new_credential = Credentials(account, userName, password)
    return new_credential
예제 #6
0
def Credentialsuser_exist(account):
    return Credentials.credentialsuser_exist(account)
예제 #7
0
def gen_password():
    gen_password = Credentials.gen_password()
    return gen_password
예제 #8
0
def delete_credentials(Credentials):
    return Credentials.delete_credentials()
예제 #9
0
def show_credentials():
    return Credentials.show_credentials()
예제 #10
0
 def test_generate_password(self):
     test_credentials = Credentials("instagram","bchizi","lehann","lbchizi") 
     test_credentials.social_password = Credentials.generate_password() 
예제 #11
0
def create_credentials(account_name, login_detail, Password):
    new_credentials = Credentials(account_name, Password)
    return new_credentials
예제 #12
0
 def test_display_credentials(self): 
     """
     method that returns a list of all credentials
     """
     self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)
예제 #13
0
 def setUp(self):
    self.new_account = Credentials ("instagram","bchizi","lehann","lbchizi")
예제 #14
0
 def test_display_credentials(self):
     '''
     test case to test if credentials are displayed
     '''
     self.assertEqual(Credentials.display_credentials(),
                      Credentials.credentials_list)
예제 #15
0
def save_credentials(credentials):
    Credentials.save_credentials(credentials)
예제 #16
0
 def test_user_account_exits(self):
     self.newlogin.save_user_account()
     test_user = Credentials("username", "password", "accountType")
     test_user.save_user_account()
     user_account_exists = Credentials.user_account_exists("username")
     self.assertEqual(user_account_exists)
예제 #17
0
def display_credentials():
    return Credentials.display_credentials()
예제 #18
0
 def test_display_user_acounts(self):
     self.assertEqual(Credentials.display_user_accounts(),
                      Credentials.user_details_list)
예제 #19
0
def find_account(account):
    return Credentials.find_account(account)
예제 #20
0
 def setUp(self):
     self.newlogin = Credentials("devgakuya", "qwerty", "DevPass")
예제 #21
0
 def test_show_credentials(self):
     '''This test will list all the credentials'''
     self.assertEqual(Credentials.list_all(), Credentials.credentials_list)
예제 #22
0
    def test_display_all_account(self):
        '''
            method that returns a list of all account saved
            '''

        self.assertEqual(Credentials.display_accounts(), Credentials.accounts)
예제 #23
0
def login_user(username, password):

    check_user = Credentials.verify_user(username, password)
    return check_user
예제 #24
0
 def setUp(self):
     '''
     Set up method to run before each test cases.
     '''
     # create user object
     self.new_account = Credentials("WhatsApp", "daudi", "password")
예제 #25
0
def display_accounts_details():

    return Credentials.display_credentials()
예제 #26
0
class TestCredentials(unittest.TestCase):
    '''
    Test class that defines test cases for the credential class behaviours.

    Args:
        unittest.TestCase: TestCase class that helps in creating test cases
    '''

    #1
    def setUp(self):
        '''
        Set up method to run before each test cases.
        '''
        # create user object
        self.new_account = Credentials("WhatsApp", "daudi", "password")

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

    def test_init(self):
        '''
        test_init test case to test if the object is initialized properly
        '''

        self.assertEqual(self.new_account.user_account_name, "WhatsApp")
        self.assertEqual(self.new_account.user_account_user, "daudi")
        self.assertEqual(self.new_account.user_account_password, "password")

    def test_save_account(self):
        '''
        test_save_user test case to test if the credential object is saved into
        the account list
        '''

        # saving the new credential account
        self.new_account.save_account()
        self.assertEqual(len(Credentials.accounts), 1)

    def test_save_multiple_accounts(self):
        '''
        test_save_multiple_accounts to check if we can save multiple accounts
        objects to our accounts
        '''
        self.new_account.save_account()
        test_account = Credentials("WhatsApp", "daudi",
                                   "password")  # new account
        test_account.save_account()
        self.assertEqual(len(Credentials.accounts), 2)

    def test_delete_account(self):
        '''
            test_delete_user to test if we can remove a account from our accounts
            '''
        self.new_account.save_account()
        test_account = Credentials("Test", "user", "password")  # new account
        test_account.save_account()

        self.new_account.accounts

        self.new_account.delete_account()  # Deleting a account object
        self.assertEqual(len(Credentials.accounts), 1)

    def test_find_account_by_number(self):
        '''
            test to check if we can find a account by phone number and display information
            '''

        self.new_account.save_account()
        test_account = Credentials("Test", "anum", "password")  # new account
        test_account.save_account()

        found_account = Credentials.find_by_number("anum")

        self.assertEqual(found_account, Credentials.find_by_number("anum"))

    # Test if account exist
    def test_account_exists(self):
        '''
            test to check if we can return a Boolean  if we cannot find the user.
            '''

        self.new_account.save_account()
        test_account = Credentials("Viber", "daudi", "12345")  # new account
        test_account.save_account()

        account_exists = Credentials.account_exist("daudi")

        self.assertTrue(account_exists)

    """
    Dispaly account user
    """

    def test_display_all_account(self):
        '''
            method that returns a list of all account saved
            '''

        self.assertEqual(Credentials.display_accounts(), Credentials.accounts)
예제 #27
0
def check_credendtials(account):

    return Credentials.if_credential_exist(account)
예제 #28
0
def create_credentials(account, username, password):
    New_credentials = Credentials(account, username, password)
    return New_credentials
예제 #29
0
def copy_password(account):

    return Credentials.copy_password(account)
예제 #30
0
 def setUp(self):
     """
     Method to define the constructor
     """
     self.cred = Credentials("Instagram", "@nyambucindy", "fox12345")