示例#1
0
 def test_save_credentials(self):
     '''
     Test for credential info
     '''
     self.new_credential.save_credentials()
     instagram = Credentials('Rose','Instagram','inst@')
     instagram.save_credentials()
     self.assertEqual(len(Credentials.credentials),2)
示例#2
0
class TestCredentials(unittest.TestCase):
    '''
    Test class for the credentials class
    '''
    def test_check_user(self):
        '''
        Function to verify whether the function check_user works
        '''
        self.new_user = User('Rose','rudim3nt@l')
        self.new_user.save_user()
        user2 = User('Rio','3liz@b3th')
        user2.save_user()

        for user in User.users:
            if user.username == user2.username and user.password == user2.password:
                current_user = user.username
        return current_user

        self.assertEqual(current_user,Credentials.check_user(user2.password,user2.username))
    
    def setUp(self):
        '''
        Function for creating account creds before test
        '''
        self.new_credential = Credentials('Rose','Instagram','inst@')

    def test__init__(self):
        '''
        Test to check on new credentials
        '''
        self.assertEqual(self.new_credential.name,'Rose')
        self.assertEqual(self.new_credential.site_name,'Instagram')
        self.assertEqual(self.new_credential.password,'inst@')
    
    def test_save_credentials(self):
        '''
        Test for credential info
        '''
        self.new_credential.save_credentials()
        instagram = Credentials('Rose','Instagram','inst@')
        instagram.save_credentials()
        self.assertEqual(len(Credentials.credentials),2)

    def tearDown(self):
        '''
        Function for clearing creds list after every test
        '''
        Credentials.credentials = []
        User.users = []
示例#3
0
    def test_check_user(self):
        '''
        Function to verify whether the function check_user works
        '''
        self.new_user = User('Rose','rudim3nt@l')
        self.new_user.save_user()
        user2 = User('Rio','3liz@b3th')
        user2.save_user()

        for user in User.users:
            if user.username == user2.username and user.password == user2.password:
                current_user = user.username
        return current_user

        self.assertEqual(current_user,Credentials.check_user(user2.password,user2.username))
示例#4
0
def copy_credential(site_name):
    '''
    Function for copying credentials to the clipboard
    '''
    return Credentials.copy_credential(site_name)
示例#5
0
def display_credentials(name):
    '''
    Function for the credentials saved by the user
    '''
    return Credentials.display_credentials(name)
示例#6
0
def save_credential(credential):
    '''
    Function to save a new credential
    '''
    Credentials.save_credentials(credential)
示例#7
0
def create_credential(name, site_name, password):
    '''
    Function for new credentials
    '''
    new_credential = Credentials(name, site_name, password)
    return new_credential
示例#8
0
def generate_password():
    '''
    Function for automatic passwords
    '''
    gen_pass = Credentials.generate_password()
    return gen_pass
示例#9
0
def verify_user(username, password):
    '''
    Function for user verification
    '''
    verifying_user = Credentials.check_user(username, password)
    return verifying_user
示例#10
0
 def setUp(self):
     '''
     Function for creating account creds before test
     '''
     self.new_credential = Credentials('Rose','Instagram','inst@')