def test_getState(self): item = MockItem(1, 'a', 'a', 'a', '1') _id = 1 name = "test" r = Room(_id, name) r.addItem(1, item) self.assertEqual(r.getState(), [{'id': 1, 'state': 1}])
def test_getStrucutre(self): item = MockItem(1, 'a', 'a', 'a', '1') _id = 1 name = "test" r = Room(_id, name) r.addItem(1, item) self.assertEqual(r.getStructure(), {'id': 1, 'name': "test", 'items': [{'id': 1, 'name': 'a', 'itemType': 'a', 'brand': 'a', 'ip': '1', 'state' : 1}]})
def test_addItem(self): item = MockItem(1, 'a', 'a', 'a', '1') _id = 1 name = "test" r = Room(_id, name) r.addItem(1, item) self.assertEqual(item, r.items[1]) self.assertEqual(len(r.items), 1)
def test_getStrucutre(self): item = MockItem(1, 'a', 'a', 'a', '1') _id = 1 name = "test" r = Room(_id, name) r.addItem(1, item) self.assertEqual( r.getStructure(), { 'id': 1, 'name': "test", 'items': [{ 'id': 1, 'name': 'a', 'itemType': 'a', 'brand': 'a', 'ip': '1', 'state': 1 }] })