Beispiel #1
0
 def test_serialize(self):
     field = ResourceMeta()
     result = field.serialize('resource_meta',
                              {'resource_meta': {
                                  'active': True
                              }})
     assert result == {'active': True}
 def test_serialize(self):
     field = ResourceMeta()
     result = field.serialize("resource_meta",
                              {"resource_meta": {
                                  "active": True
                              }})
     assert result == {"active": True}
Beispiel #3
0
 def test_deserialize_incorrect_type(self):
     field = ResourceMeta()
     value = True
     with pytest.raises(ValidationError) as excinfo:
         field.deserialize(value)
     assert excinfo.value.args[0] == 'Not a valid mapping type.'
Beispiel #4
0
 def test_deserialize(self):
     field = ResourceMeta()
     value = {'active': True}
     result = field.deserialize(value)
     assert result == value
Beispiel #5
0
 def test_serialize_incorrect_type(self):
     field = ResourceMeta()
     with pytest.raises(ValidationError) as excinfo:
         field.serialize('resource_meta', {'resource_meta': True})
     assert excinfo.value.args[0] == 'Not a valid mapping type.'