def test_model_to_json(self):
swagger_dict = yaml.load(Tests.yaml_complex_model)
spec = ApiSpec(swagger_dict)
Foo = spec.definitions['Foo']
Bar = spec.definitions['Bar']
f = Foo(
token='abcd',
bar=Bar(
a=1,
b=date.today()
)
)
print("foo: " + pprint.pformat(f))
j = spec.model_to_json(f)
self.assertDictEqual(j, {
'token': 'abcd',
'bar': {
'a': 1,
'b': date.today().isoformat()
}
})
test_swagger_spec.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录