<filename>user_test.py<gh_stars>0

import pyperclip #importing pyperclip
  

def test_copy_name(self):  
    '''
    Test to confirm that we are copying the name from a found user
    ''' 
    self.new_user.save_user()
    user.copy_name("Juliet")
    user.copy_password("<PASSWORD>*")

    self.assertEqual(self.new_user.name,pyperclip.paste()) 



import unittest #importing the unitest module
from user import user #importing user class


class Testuser(unittest.TestCase):

    '''
    Test class that defines test cases for the user class behaviours.

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

    def setUp(self):    
        '''
        Set up method to run before each test cases.
        '''
        self.new_user = user("Juliet","Igot<PASSWORD>*") #create user object

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

        self.assertEqual(self.new_user.user_name,"Juliet")  
        self.assertEqual(self.new_user.password,"<PASSWORD>*")
        self.assertEqual(self.new_user.email,"<EMAIL>") 

    def test_save_user(self):
        '''
        test_save_user test case test if the user object is saved
        ''' 
        self.new_user.save_user()
        self.assertEqual(len(user.user_list),1)  

    def test_delete_user(self):
        '''
        test_delete_user to test if credential can be deleted
        '''
        self.new_user.delete_user()#Deleting a user
        self.assertEqual(len(user.user_list),1)

    @classmethod
    def find_by_email(cls,email):
        '''
        Method that takes in an email and returns a contact matching that user.

        Args:
            email: email to search for
        Returns :
            user of person matching the email.
        '''

        for user in cls.user_list:
            if user.email == email:
                return user 
                  


if __name__ == '__main__':
    unittest.main()
<filename>user_test.py<gh_stars>0

import pyperclip #importing pyperclip
  

def test_copy_name(self):  
    '''
    Test to confirm that we are copying the name from a found user
    ''' 
    self.new_user.save_user()
    user.copy_name("Juliet")
    user.copy_password("<PASSWORD>*")

    self.assertEqual(self.new_user.name,pyperclip.paste()) 



import unittest #importing the unitest module
from user import user #importing user class


class Testuser(unittest.TestCase):

    '''
    Test class that defines test cases for the user class behaviours.

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

    def setUp(self):    
        '''
        Set up method to run before each test cases.
        '''
        self.new_user = user("Juliet","Igot<PASSWORD>*") #create user object

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

        self.assertEqual(self.new_user.user_name,"Juliet")  
        self.assertEqual(self.new_user.password,"<PASSWORD>*")
        self.assertEqual(self.new_user.email,"<EMAIL>") 

    def test_save_user(self):
        '''
        test_save_user test case test if the user object is saved
        ''' 
        self.new_user.save_user()
        self.assertEqual(len(user.user_list),1)  

    def test_delete_user(self):
        '''
        test_delete_user to test if credential can be deleted
        '''
        self.new_user.delete_user()#Deleting a user
        self.assertEqual(len(user.user_list),1)

    @classmethod
    def find_by_email(cls,email):
        '''
        Method that takes in an email and returns a contact matching that user.

        Args:
            email: email to search for
        Returns :
            user of person matching the email.
        '''

        for user in cls.user_list:
            if user.email == email:
                return user 
                  


if __name__ == '__main__':
    unittest.main()
#importing pyperclip Test to confirm that we are copying the name from a found user #importing the unitest module #importing user class Test class that defines test cases for the user class behaviours.      Args:         unittest.TestCase: class that helps in creating test cases Set up method to run before each test cases. #create user object test_init test case to test if the object is initialized properly test_save_user test case test if the user object is saved test_delete_user to test if credential can be deleted #Deleting a user Method that takes in an email and returns a contact matching that user.          Args:             email: email to search for         Returns :             user of person matching the email.