Example #1
0
    def test_copy_pass(self):
        '''
        Testing if password has been copied
        '''
        self.new_userdata.save_website()
        UserData.copy_pass(1,"Michel")

        self.assertEqual(self.new_userdata.webpass,pyperclip.paste())
Example #2
0
    def test_userdata_exists(self):
        '''
        Testing if method for checking userdata works
        '''
        self.new_userdata.save_website()
        test_userdata = UserData(1,"Michel","twitter.com","yolo")
        test_userdata.save_website()

        userdata_exists = UserData.existing_userdata("Michel")
        self.assertTrue(userdata_exists)
Example #3
0
    def test_display_userdata(self):
        '''
        method that returns a list of all websites saved
        '''
        self.new_userdata.save_website()
        test_userdata = UserData(1,"Michel","twitter.com","yolo")
        test_userdata.save_website()

        userdata_found = UserData.display_userdata(1,"Michel")
        self.assertEqual(userdata_found.website, test_userdata.website)
Example #4
0
def copy_pass(number, count):
    '''
    Function that copies password to clipboard
    '''
    UserData.copy_pass(number, count)
Example #5
0
def userdata_existing(userdata):
    '''
    Function that checks if userdata exists 
    '''
    return UserData.existing_userdata(userdata)
Example #6
0
def display_userdata(userdata, number):
    '''
    Function that displays user data
    '''
    return UserData.display_userdata(userdata, number)
Example #7
0
def my_new_userdata(newuser_id, username, website, webpass):
    '''
    Function that creates new userdata
    '''
    new_userdata = UserData(newuser_id, username, website, webpass)
    return new_userdata
Example #8
0
 def setUp(self):
 
     '''
     Set up method to run before each test cases.
     '''
     self.new_userdata = UserData(1,"Michel","twitter.com","yolo")
Example #9
0
class TestUserData(unittest.TestCase):

    def setUp(self):
    
        '''
        Set up method to run before each test cases.
        '''
        self.new_userdata = UserData(1,"Michel","twitter.com","yolo")

    def tearDown(self):
        '''
        tearDown method that does clean up after each test case has run
        '''
        UserData.userdata_list = []
    
    def test_init(self):

        '''
        Test class that defines test case for website and logging in
        '''
        self.assertEqual(self.new_userdata.id, 1)
        self.assertEqual(self.new_userdata.username,"Michel")
        self.assertEqual(self.new_userdata.website,"twitter.com")
        self.assertEqual(self.new_userdata.webpass,"yolo")

    def test_save_website(self):
        '''
        tests case to test if website and webpass can be saved
        '''

        self.new_userdata.save_website() #saving new website
        self.assertEqual(len(UserData.userdata_list),1)

    def test_display_userdata(self):
        '''
        method that returns a list of all websites saved
        '''
        self.new_userdata.save_website()
        test_userdata = UserData(1,"Michel","twitter.com","yolo")
        test_userdata.save_website()

        userdata_found = UserData.display_userdata(1,"Michel")
        self.assertEqual(userdata_found.website, test_userdata.website)

    def test_userdata_exists(self):
        '''
        Testing if method for checking userdata works
        '''
        self.new_userdata.save_website()
        test_userdata = UserData(1,"Michel","twitter.com","yolo")
        test_userdata.save_website()

        userdata_exists = UserData.existing_userdata("Michel")
        self.assertTrue(userdata_exists)

    def test_copy_pass(self):
        '''
        Testing if password has been copied
        '''
        self.new_userdata.save_website()
        UserData.copy_pass(1,"Michel")

        self.assertEqual(self.new_userdata.webpass,pyperclip.paste())