示例#1
0
class LockTest(unittest.TestCase):
    def setUp(self):
        self.lock=Lock('3176','BE', 'normal')

    def test_lockstring(self):
        self.assertEqual(str(self.lock), '3176 locked')

    def test_getStatus(self):
        self.assertEqual(self.lock.getStatus(), 'locked')

    def test_setStatus(self):
        self.lock.setStatus('unlocked')
        self.assertEqual(self.lock.getStatus(), 'unlocked')
    
    def test_GetDoor(self):
        self.assertEqual(self.lock.getDoor(), '3176')
示例#2
0
class LockTest(unittest.TestCase):
    def setUp(self):
        self.lock = Lock(3176, 'be', 'normal')

    def test_lockString(self):
        self.assertEqual(str(self.lock), '3176 locked')

    def test_securityLevel(self):
        self.assertEqual(str(self.lock.getSecurityLevel()), 'normal')

    def test_SetStatus(self):
        self.lock.setStatus('unlocked')
        self.assertEqual(self.lock.getStatus(), 'unlocked')

    def test_GetDoor(self):
        self.assertEqual(str(self.lock.getDoor()), '3176')

    def test_GetLocation(self):
        self.assertEqual(self.lock.getLoction(), 'be')