Exemple #1
0
 def test_remove_credential(self):
     ''' A test for testing if we can delete a credential from  the credential  list'''
     self.new_credential.saved_credential()
     test_saved_credential = Credentials("vperry", "twitter", "xyz")
     test_saved_credential.saved_credential()
     self.new_credential.remove_credential()
     self.assertEqual(len(Credentials.credentials_list), 1)
Exemple #2
0
 def test_existing_credentials(self):
     '''
     test to confirm if the user is in the list,if the user does not exist we will get a false response
     '''
     self.new_credential.saved_credential()
     test_saved_credential = Credentials("vperry", "twitter", "xyz")
     test_saved_credential.saved_credential()
     existing_credental = Credentials.credentials_inlist("vperry")
     self.assertTrue(existing_credental)
Exemple #3
0
    def test_find_credential(self):
        '''
        Tests whether a user can find a credential based on a username
        '''
        test_credential = Credentials("Virginia", "facebook", "virgyperry")
        Credentials.saved_credential(test_credential)

        self.assertEqual(
            Credentials.find_credential("Virginia").username,
            test_credential.username)
Exemple #4
0
class TestCredentials(unittest.TestCase):
    def setUp(self):
        '''
        method to run before and after each test 
        '''
        self.new_credential = Credentials("vperry", "twitter", "xyz")

    def test_init(self):
        '''
        test to show if the object is initialized properly
        '''
        self.assertEqual(self.new_credential.username, "vperry")
        self.assertEqual(self.new_credential.accounts, "twitter")
        self.assertEqual(self.new_credential.password, "xyz")

    def tearDown(self):
        '''
        cleans up after each test is run.
        '''
        Credentials.credentials_list = []

    def test_saved_credential(self):
        '''
        test to show if the credentials are added into the credentials  list
        '''
        self.new_credential.saved_credential()
        self.assertEqual(len(Credentials.credentials_list), 1)

    def test_remove_credential(self):
        ''' A test for testing if we can delete a credential from  the credential  list'''
        self.new_credential.saved_credential()
        test_saved_credential = Credentials("vperry", "twitter", "xyz")
        test_saved_credential.saved_credential()
        self.new_credential.remove_credential()
        self.assertEqual(len(Credentials.credentials_list), 1)

    def test_existing_credentials(self):
        '''
        test to confirm if the user is in the list,if the user does not exist we will get a false response
        '''
        self.new_credential.saved_credential()
        test_saved_credential = Credentials("vperry", "twitter", "xyz")
        test_saved_credential.saved_credential()
        existing_credental = Credentials.credentials_inlist("vperry")
        self.assertTrue(existing_credental)

    def test_show_credentials(self):
        '''This test will list all the credentials'''
        self.assertEqual(Credentials.list_all(), Credentials.credentials_list)

    def test_find_credential(self):
        '''
        Tests whether a user can find a credential based on a username
        '''
        test_credential = Credentials("Virginia", "facebook", "virgyperry")
        Credentials.saved_credential(test_credential)

        self.assertEqual(
            Credentials.find_credential("Virginia").username,
            test_credential.username)