Beispiel #1
0
class TestCredentials(unittest.TestCase):
    def setUp(self):
        self.newCredentials = Credential('test1', '*****@*****.**', '0000')

    def testInit(self):
        self.assertEqual(self.newCredentials.account, 'test1')
        self.assertEqual(self.newCredentials.username, '*****@*****.**')
        self.assertEqual(self.newCredentials.password, '0000')

    def testSaveCredentials(self):
        self.newCredentials.saveCredentials()
        testCredentials = Credential('test2', '*****@*****.**', '1111')

        testCredentials.saveCredentials()
        self.assertEqual(len(Credential.credentialList), 2)

    def tearDown(self):
        Credential.credentialList = []

    def testSaveMultipleCredentials(self):

        self.newCredentials.saveCredentials()
        self.assertEqual(len(Credential.credentialList), 1)

    def testDeleteCredentials(self):
        self.newCredentials.saveCredentials()
        testCredentials = Credential('test3', '*****@*****.**', '2222')
        testCredentials.saveCredentials()

        self.newCredentials.deleteCredentials('test3')
        self.assertEqual(len(Credential.credentialList), 1)
Beispiel #2
0
def deleteCredentials(account):
    return Credential.deleteCredentials(account)