-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcredentials_test.py
56 lines (40 loc) · 1.7 KB
/
credentials_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import unittest
from credentials import Credentials
class TestCredentials(unittest.TestCase):
'''
Test class that checks the behaviours of the credentials class.
'''
def setUp(self):
self.new_credentials = Credentials("michael","Instagram","michael", "password") # create contact object
def test_init(self):
self.assertEqual(self.new_credentials.username,"michael")
self.assertEqual(self.new_credentials.account,"Instagram")
self.assertEqual(self.new_credentials.acc_credentialsname,"michael")
self.assertEqual(self.new_credentials.acc_password,"password")
def test_save_credentials(self):
self.new_credentials.save_credentials()
self.assertEqual(len(Credentials.credentials_list),1)
def tearDown(self):
'''
this will clean up after each test run.
'''
Credentials.credentials_list = []
def test_save_multiple_credentials(self):
'''
check if a credentials account can hold multiple credentials
'''
self.new_credentials.save_credentials()
test_credentials = Credentials("michael","Twitter","michael","password")
test_credentials.save_credentials()
self.assertEqual(len(Credentials.credentials_list),2)
def test_delete_credentials(self):
'''
test_delete_credentials to test if we can remove a credentials from our credentials list
'''
self.new_credentials.save_credentials()
test_credentials = Credentials("michael","Instagram", "michael", "password")
test_credentials.save_credentials()
self.new_credentials.delete_credentials()
self.assertEqual(len(Credentials.credentials_list),1)
if __name__ == '__main__':
unittest.main()