Beispiel #1
0
def login_user(username, password):
    """
    function that enables existing users to login.
    """

    check_user = Credentials.verify_user(username, password)
    return check_user
Beispiel #2
0
class CredentialsTest(unittest.TestCase):
   
    '''
    Testing class that defines test cases
    '''
    def setUp(self):
        '''
        setUp runs before testcase'
        '''

        self.newCredentials = Credentials('MITCHEL','MUTHONI','NJUGUNAS','YHS67','*****@*****.**')

    def test_init(self):
        self.assertEqual(self.newCredentials.Fname,'MITCHEL')
        self.assertEqual(self.newCredentials.Sname,'MUTHONI')
        self.assertEqual(self.newCredentials.username,'NJUGUNAS')
        self.assertEqual(self.newCredentials.password,'YHS67')
        self.assertEqual(self.newCredentials.email,'*****@*****.**')

    def tearDown(self):
         Credentials.credentials_list = []

        # save a user
    def test_saveCredentials(self):
        self.newCredentials.saveCredentials()
        self.assertEqual(len(Credentials.credentials_list),1)

        #save multiple users
    def  test_savemore(self):
        self.newCredentials.saveCredentials()
        test = Credentials('jane','Doe','jadoe','djdj9','*****@*****.**')
        test.saveCredentials()
        self.assertEqual(len(Credentials.credentials_list),2)

        # delete user
    def test_delete(self):
        self.newCredentials.saveCredentials()
        test = Credentials('John','Doe','JD','ddduu773','*****@*****.**')
        test.saveCredentials()
        self.newCredentials.delete()
        self.assertEqual(len(Credentials.credentials_list),1)
Beispiel #3
0
def generate_password():
    '''
    Function that generates a password for the user
    '''
    return Credentials.generatePassword()
Beispiel #4
0
def create_password(account, password):
    '''
    Function to create new password
    '''
    new_pass = Credentials(account, password)
    return new_pass
Beispiel #5
0
 def test_delete(self):
     self.newCredentials.saveCredentials()
     test = Credentials('John','Doe','JD','ddduu773','*****@*****.**')
     test.saveCredentials()
     self.newCredentials.delete()
     self.assertEqual(len(Credentials.credentials_list),1)
Beispiel #6
0
 def  test_savemore(self):
     self.newCredentials.saveCredentials()
     test = Credentials('jane','Doe','jadoe','djdj9','*****@*****.**')
     test.saveCredentials()
     self.assertEqual(len(Credentials.credentials_list),2)
Beispiel #7
0
    def setUp(self):
        '''
        setUp runs before testcase'
        '''

        self.newCredentials = Credentials('MITCHEL','MUTHONI','NJUGUNAS','YHS67','*****@*****.**')
Beispiel #8
0
def create(fname,lname,user,passwords,email):
    newCredentials = Credentials(fname,lname,user,passwords,email)
    return newCredentials
Beispiel #9
0
def account_exists(email):
    return Credentials.accounts_display(email)
Beispiel #10
0
def saveCredentials(Credentials):
    Credentials.saveCredentials()
Beispiel #11
0
def copy_password(account):
    """
    A function that allows users to copy password using pyperclip.
    """
    return Credentials.copy_password(account)
Beispiel #12
0
def check_credendtials(account):
    """
    Function that checks if Credentials exists with an account name and return a boolean
    """
    return Credentials.if_credential_exist(account)
Beispiel #13
0
def find_credential(account):
    """
    Function that finds Credentials of an account by account name
    """
    return Credentials.find_credential(account)
Beispiel #14
0
def display_accounts_details():
    """
    Function that displays saved credential.
    """
    return Credentials.display_credentials()
Beispiel #15
0
def create_new_credential(account, userName, password):
    """
    Function that creates new credentials for a given user account
    """
    new_credential = Credentials(account, userName, password)
    return new_credential