forked from faif/python-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_borg.py
32 lines (25 loc) · 857 Bytes
/
test_borg.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
#!/usr/bin/env python
from borg import Borg, YourBorg
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
class BorgTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.b1 = Borg()
self.b2 = Borg()
self.ib1 = YourBorg()
def test_initial_borg_state_shall_be_init(self):
b = Borg()
self.assertEqual(b.state, 'Init')
def test_changing_instance_attribute_shall_change_borg_state(self):
self.b1.state = 'Running'
self.assertEqual(self.b1.state, 'Running')
self.assertEqual(self.b2.state, 'Running')
self.assertEqual(self.ib1.state, 'Running')
def test_instances_shall_have_own_ids(self):
self.assertNotEqual(id(self.b1), id(self.b2), id(self.ib1))
if __name__ == "__main__":
unittest.main()