コード例 #1
0
 def test_all_mappings_serialization(self):
     e = AllMappings(mappings=[
         Mapping(priority=1),
     ],
                     meta=MappingMeta(total=1))
     serialized = e.get_json_data()
     self.assertDictContainsKeyWithValue(serialized, "mappings", [
         {
             "priority": 1
         },
     ])
     self.assertDictContainsKeyWithValue(serialized, "meta", {"total": 1})
コード例 #2
0
 def test_all_mappings_serialization(self):
     e = AllMappings(mappings=[
         Mapping(priority=1),
     ],
                     meta=MappingMeta(total=1))
     serialized = e.get_json_data()
     self.assertDictContainsKeyWithValue(serialized, 'mappings', [
         {
             'priority': 1
         },
     ])
     self.assertDictContainsKeyWithValue(serialized, 'meta', {'total': 1})
コード例 #3
0
 def test_mapping_meta_deserialization(self):
     serialized = {"total": 1}
     e = MappingMeta.from_dict(serialized)
     self.assertIsInstance(e, MappingMeta)
     self.assertEqual(1, e.total)
コード例 #4
0
 def test_mapping_meta_serialization(self):
     e = MappingMeta(total=1)
     serialized = e.get_json_data()
     self.assertDictContainsKeyWithValue(serialized, "total", 1)