<gh_stars>0
from dataclass import Account,Passwords
import pyperclip
import unittest
class testContact(unittest.TestCase):
    def setUp(self):
            '''
            Set up method to run before each test cases.
            '''
            self.new_account = Account("Mark","Chege","<EMAIL>") # create account object


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

        self.assertEqual(self.new_account.firstname,"Mark")
        self.assertEqual(self.new_account.lastname,"Chege")
        self.assertEqual(self.new_account.email,"<EMAIL>")


    def test_save_Account(self):
        '''
        test_save_contact test case to test if the contact object is saved into
        the contact list
        '''
        self.new_account.saveaccount() # saving the new contact
        self.assertEqual(len(Account.account_list),1)

    def tearDown(self):
        '''
        tearDown method that does clean up after each test case has run.
        '''
        Account.account_list = []    
    
    def test_save_multiple_Account(self):
        '''
        test_save_contact test case to test if the contact object is saved into
        the contact list
        '''
        self.new_account.saveaccount() 
        test_account = Account("Test","user","<EMAIL>") 
        test_account.saveaccount()
        self.assertEqual(len(Account.account_list),2)

    # def test_find_by_credential(self):
    #     '''
    #     test_save_contact test case to test if the contact object is saved into
    #     the contact list
    #     '''
    #     self.savepassword() 
    #     test_password = Passwords("<PASSWORD>","<EMAIL>","facebook") # new contact
    #     test_password.savepassword()

    #     found_credential =  Passwords.find_by_credential("facebook")

    #     self.assertEqual(found_credential.password , test_password.email) 
         

if __name__ == '__main__':
    unittest.main() 
from dataclass import Account,Passwords
import pyperclip
import unittest
class testContact(unittest.TestCase):
    def setUp(self):
            '''
            Set up method to run before each test cases.
            '''
            self.new_account = Account("Mark","Chege","<EMAIL>") # create account object


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

        self.assertEqual(self.new_account.firstname,"Mark")
        self.assertEqual(self.new_account.lastname,"Chege")
        self.assertEqual(self.new_account.email,"<EMAIL>")


    def test_save_Account(self):
        '''
        test_save_contact test case to test if the contact object is saved into
        the contact list
        '''
        self.new_account.saveaccount() # saving the new contact
        self.assertEqual(len(Account.account_list),1)

    def tearDown(self):
        '''
        tearDown method that does clean up after each test case has run.
        '''
        Account.account_list = []    
    
    def test_save_multiple_Account(self):
        '''
        test_save_contact test case to test if the contact object is saved into
        the contact list
        '''
        self.new_account.saveaccount() 
        test_account = Account("Test","user","<EMAIL>") 
        test_account.saveaccount()
        self.assertEqual(len(Account.account_list),2)

    # def test_find_by_credential(self):
    #     '''
    #     test_save_contact test case to test if the contact object is saved into
    #     the contact list
    #     '''
    #     self.savepassword() 
    #     test_password = Passwords("<PASSWORD>","<EMAIL>","facebook") # new contact
    #     test_password.savepassword()

    #     found_credential =  Passwords.find_by_credential("facebook")

    #     self.assertEqual(found_credential.password , test_password.email) 
         

if __name__ == '__main__':
    unittest.main()
Set up method to run before each test cases. # create account object test_init test case to test if the object is initialized properly test_save_contact test case to test if the contact object is saved into         the contact list # saving the new contact tearDown method that does clean up after each test case has run. test_save_contact test case to test if the contact object is saved into         the contact list # def test_find_by_credential(self): #     ''' #     test_save_contact test case to test if the contact object is saved into #     the contact list #     ''' #     self.savepassword() #     test_password = Passwords("<PASSWORD>","<EMAIL>","facebook") # new contact #     test_password.savepassword() #     found_credential =  Passwords.find_by_credential("facebook") #     self.assertEqual(found_credential.password , test_password.email)