Esempio n. 1
0
 def test_save_multiple_accounts(self):
     '''
     test to check if we can save multiple credentials objects to our credentials list
     '''
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Twitter','Abzed','Abzedar2')
     test_credentials.save_credentials()
     self.assertEqual(len(Credentials.credentials_list),2)
Esempio n. 2
0
 def test_find_credentials(self):
     """
     test to check if we can find credential using account name
     """
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Twitter','Abzed','Abzedar2')
     test_credentials.save_credentials()
     found_credentials = Credentials.find_account_name('Twitter')
     self.assertEqual(found_credentials.account_name,test_credentials.account_name)
Esempio n. 3
0
 def test_credentials_exist(self):
     """
     test to check if we can return a true or false based on whether we find or can't find the credential.
     """
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Twitter','Abzed','Abzedar2')
     test_credentials.save_credentials()
     credentials_exist = Credentials.credentials_exist('Twitter')
     self.assertTrue(credentials_exist)
Esempio n. 4
0
 def test_delete_credential(self):
     """
     test method to test if we can remove an account credentials from our credentials_list
     """
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Twitter','Abzed','Abzedar2')
     test_credentials.save_credentials()
     self.new_credentials.delete_credentials()
     self.assertEqual(len(Credentials.credentials_list),1)
Esempio n. 5
0
 def test_save_multiple_accounts(self):
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Facebook','Aoko','Mercy2x0')
     test_credentials.save_credentials()
     self.assertEqual(len(Credentials.credentials_list),2)
Esempio n. 6
0
def copy_credentials():
    return Credentials.copy_credentials()
Esempio n. 7
0
def generate_password():
    gen_pwrd = Credentials.generate_password()
    return gen_pwrd
Esempio n. 8
0
def find_credentials(account_name):
    return Credentials.find_account_name(account_name)
Esempio n. 9
0
def check_credentials(account_name):
    return Credentials.credentials_exist()
Esempio n. 10
0
def display_credentials():
    return Credentials.display_credentials()
Esempio n. 11
0
def create_credentials(account_name, username, password):
    new_credentials = Credentials(account_name, username, password)
    return new_credentials
Esempio n. 12
0
def display_credential_list():
    """
    Function that returns all the saved credential.
    """
    return Credentials.display_credentials()
Esempio n. 13
0
 def test_credentials_exist(self):
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Facebook','Aoko','Mercy2x0')
     test_credentials.save_credentials()
     credentials_exist = Credentials.credentials_exist('Facebook')
     self.assertTrue(credentials_exist)
Esempio n. 14
0
 def test_delete_credential(self):
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Facebook','Aoko','Mercy2x0')
     test_credentials.save_credentials()
     self.new_credentials.delete_credentials()
     self.assertEqual(len(Credentials.credentials_list),1)
Esempio n. 15
0
def check_credentials(account_name):
    """
    Function that check if a Credentials exists with that account name and return true or false
    """
    return Credentials.credentials_exist()
Esempio n. 16
0
 def setUp(self):
     """
     Method that runs before each individual credentials test methods run.
     """
     self.new_credentials = Credentials('Instagram','Abzed','Abzed1z0')
Esempio n. 17
0
class TestCredentials(unittest.TestCase):
    """
    A test class that defines test cases for credentials class
    """ 
    
    def setUp(self):
        """
        Method that runs before each individual credentials test methods run.
        """
        self.new_credentials = Credentials('Instagram','Abzed','Abzed1z0')
        
    def  test_init(self):
        """
        Test case to check if a new Credentials instance has been initialized correctly
        """
        self.assertEqual(self.new_credentials.account_name,'Instagram')
        self.assertEqual(self.new_credentials.username,'Abzed')
        self.assertEqual(self.new_credentials.password,'Abzed1z0')
        
    def test_save_credentials(self):
        """
        test case to test if the crential object is saved into the credentials list.
        """
        self.new_credentials.save_credentials()
        self.assertEqual(len(Credentials.credentials_list),1)
        
    def tearDown(self):
        '''
        method that does clean up after each test case has run.
        '''
        Credentials.credentials_list = []
        
    def test_save_multiple_accounts(self):
        '''
        test to check if we can save multiple credentials objects to our credentials list
        '''
        self.new_credentials.save_credentials()
        test_credentials = Credentials('Twitter','Abzed','Abzedar2')
        test_credentials.save_credentials()
        self.assertEqual(len(Credentials.credentials_list),2)
        
    def test_delete_credential(self):
        """
        test method to test if we can remove an account credentials from our credentials_list
        """
        self.new_credentials.save_credentials()
        test_credentials = Credentials('Twitter','Abzed','Abzedar2')
        test_credentials.save_credentials()
        self.new_credentials.delete_credentials()
        self.assertEqual(len(Credentials.credentials_list),1)
        
    def test_find_credentials(self):
        """
        test to check if we can find credential using account name
        """
        self.new_credentials.save_credentials()
        test_credentials = Credentials('Twitter','Abzed','Abzedar2')
        test_credentials.save_credentials()
        found_credentials = Credentials.find_account_name('Twitter')
        self.assertEqual(found_credentials.account_name,test_credentials.account_name)
        
    def test_credentials_exist(self):
        """
        test to check if we can return a true or false based on whether we find or can't find the credential.
        """
        self.new_credentials.save_credentials()
        test_credentials = Credentials('Twitter','Abzed','Abzedar2')
        test_credentials.save_credentials()
        credentials_exist = Credentials.credentials_exist('Twitter')
        self.assertTrue(credentials_exist)
        
    def display_credentials(self):
        '''
        method that displays all the credentials that has been saved by the user
        '''
        self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)
Esempio n. 18
0
def generate_password():
    '''
    generates a random password for the user.
    '''
    gen_pwrd = Credentials.generate_password()
    return gen_pwrd
Esempio n. 19
0
def find_credentials(account_name):
    """
    Function that finds a Credentials by an account name and returns the Credentials that belong to that account
    """
    return Credentials.find_account_name(account_name)
Esempio n. 20
0
 def test_find_credentials(self):
     self.new_credentials.save_credentials()
     test_credentials = Credentials('Facebook','Aoko','Mercy2x0')
     test_credentials.save_credentials()
     found_credentials = Credentials.find_account_name('Facebook')
     self.assertEqual(found_credentials.account_name,test_credentials.account_name)
Esempio n. 21
0
 def display_credentials(self):
     '''
     method that displays all the credentials that has been saved by the user
     '''
     self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)
Esempio n. 22
0
 def display_credentials(self):
     self.assertEqual(Credentials.display_credentials(),Credentials.credentials_list)
Esempio n. 23
0
def create_credentials(account_name, username, password):
    """
    Function that creates new credentials for a given user account
    """
    new_credentials = Credentials(account_name, username, password)
    return new_credentials