Exemplo n.º 1
0
    def test_mapping_spec_serialization(self):
        spec = {
            'attr1': {
                'attr1': {
                    'attr1': 'wunderbar'
                }
            }
        }

        spec_obj_1 = test_specs.MockMappingSpec(spec, member=True)

        expected_data = {
            'catalog': spec_obj_1.get_catalog(),
            'version': spec_obj_1.get_version(),
            'member': spec_obj_1.member,
            'spec': spec_obj_1.spec
        }

        spec_obj_1_json = spec_obj_1.serialize()

        self.assertDictEqual(spec_obj_1_json, expected_data)

        spec_obj_2 = test_specs.MockMappingSpec.deserialize(spec_obj_1_json)

        self.assertEqual(spec_obj_2.member, spec_obj_1.member)
        self.assertDictEqual(spec_obj_2.spec, spec_obj_1.spec)
Exemplo n.º 2
0
    def test_mapping_spec_serialization(self):
        spec = {"attr1": {"attr1": {"attr1": "wunderbar"}}}

        spec_obj_1 = test_specs.MockMappingSpec(spec, member=True)

        expected_data = {
            "catalog": spec_obj_1.get_catalog(),
            "version": spec_obj_1.get_version(),
            "member": spec_obj_1.member,
            "spec": spec_obj_1.spec,
        }

        spec_obj_1_json = spec_obj_1.serialize()

        self.assertDictEqual(spec_obj_1_json, expected_data)

        spec_obj_2 = test_specs.MockMappingSpec.deserialize(spec_obj_1_json)

        self.assertEqual(spec_obj_2.member, spec_obj_1.member)
        self.assertDictEqual(spec_obj_2.spec, spec_obj_1.spec)