Esempio n. 1
0
    def test_password_autogenerate(self):

        # test method to test auto generation of passwords

        self.new_account.save_account()
        another_account = Credentials("Blog", "Ger")
        another_account.save_account()
Esempio n. 2
0
    def test_dislay_accounts(self):

        # test method for displaying  accounts

        self.new_account.save_account()
        another_account = Credentials("Gscroll", "Edward", "Young-Tad")
        another_account.save_account()
        self.assertEqual(Credentials.display_accounts(),
                         Credentials.usercredential)
Esempio n. 3
0
 def test_save_multiple(self):
     '''
     test method to check if user can add many accounts
     '''
     self.new_account.save_account()
     another_account = Credentials("Instagram", "Robert", "Alai1234")
     another_account.save_account()
     self.assertEqual(len(Credentials.usercredential),
                      2)  # We should have two of them
Esempio n. 4
0
 def test_delete_account(self):
     '''
     test method to check if an account has been deleted
     '''
     self.new_account.save_account()
     another_account = Credentials("LinkedIn", "Sam", "Yayers")
     another_account.save_account()
     self.new_account.delete_account()
     self.assertEqual(len(Credentials.usercredential), 1)
Esempio n. 5
0
 def test_search_accounts(self):
     '''
     test method to test search functionality
     '''
     self.new_account.save_account()
     another_account = Credentials("Facebook", "Kevin", "Stano1234")
     another_account.save_account()
     self.assertEqual(another_account,
                      Credentials.search_accounts("Facebook"))
Esempio n. 6
0
 def setUp(self):
     '''
     method run before each test.  Gives the cutting guideline 
     '''
     self.new_account = Credentials("Twitter", "cyprian", "MyPassword")
Esempio n. 7
0
class UserClassTest(unittest.TestCase):
    def setUp(self):
        '''
        method run before each test.  Gives the cutting guideline 
        '''
        self.new_account = Credentials("Twitter", "cyprian", "MyPassword")

    def tearDown(self):
        '''
        method run after each test to avoid errors just as explained in the LMS
        should come before the test. 
        '''
        Credentials.usercredential = []

    def test_init(self):
        '''
        test to check for proper initialization
        '''
        self.assertEqual(self.new_account.account_name, "Twitter")
        self.assertEqual(self.new_account.username, "cyprian")
        self.assertEqual(self.new_account.password, "MyPassword")

    def test_save_account(self):
        '''
        test method that checks if account has been saved
        '''
        self.new_account.save_account()
        self.assertEqual(len(Credentials.usercredential), 1)

    def test_save_multiple(self):
        '''
        test method to check if user can add many accounts
        '''
        self.new_account.save_account()
        another_account = Credentials("Instagram", "Robert", "Alai1234")
        another_account.save_account()
        self.assertEqual(len(Credentials.usercredential),
                         2)  # We should have two of them

    def test_delete_account(self):
        '''
        test method to check if an account has been deleted
        '''
        self.new_account.save_account()
        another_account = Credentials("LinkedIn", "Sam", "Yayers")
        another_account.save_account()
        self.new_account.delete_account()
        self.assertEqual(len(Credentials.usercredential), 1)

    def test_password_autogenerate(self):

        # test method to test auto generation of passwords

        self.new_account.save_account()
        another_account = Credentials("Blog", "Ger")
        another_account.save_account()

    def test_dislay_accounts(self):

        # test method for displaying  accounts

        self.new_account.save_account()
        another_account = Credentials("Gscroll", "Edward", "Young-Tad")
        another_account.save_account()
        self.assertEqual(Credentials.display_accounts(),
                         Credentials.usercredential)

    def test_search_accounts(self):
        '''
        test method to test search functionality
        '''
        self.new_account.save_account()
        another_account = Credentials("Facebook", "Kevin", "Stano1234")
        another_account.save_account()
        self.assertEqual(another_account,
                         Credentials.search_accounts("Facebook"))
Esempio n. 8
0
def display_account():

    # function to display all accounts saved

    return Credentials.display_accounts()
Esempio n. 9
0
def generate_password():

    # function to generate a password

    random_password = Credentials.password_generate()
    return random_password
Esempio n. 10
0
def search_accounts(search):

    # function to find an account by account name

    return Credentials.search_accounts(search)
Esempio n. 11
0
def create_account(account, u_name, passwd):

    # function to create a new account

    new_account = Credentials(account, u_name, passwd)
    return new_account