def test_put_root_update_response(self): attr1 = StringMeta("dummy").make_attribute() attr2 = StringMeta("dummy2").make_attribute() new_block_structure = OrderedDict(typeid='malcolm:core/Block:1.0') new_block_structure["attr1"] = attr1.to_dict() new_block_structure["attr2"] = attr2.to_dict() response = MagicMock(id=self.cc.BLOCK_ID, changes=[[[], new_block_structure]]) self.cc.put(response) self.assertEqual(self.b.to_dict(), new_block_structure)
def test_put_root_update_response(self): attr1 = StringMeta("dummy").make_attribute() attr2 = StringMeta("dummy2").make_attribute() new_block_structure = OrderedDict(typeid='malcolm:core/Block:1.0') new_block_structure["attr1"] = attr1.to_dict() new_block_structure["attr2"] = attr2.to_dict() response = MagicMock( id=self.cc.BLOCK_ID, changes=[[[], new_block_structure]]) self.cc.put(response) self.assertEqual(self.b.to_dict(), new_block_structure)
def test_to_dict(self): a = StringMeta("desc").make_attribute() a.set_value("some string") self.assertEqual(a.to_dict(), self.serialized)