Commit 0d9ff387 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

slapos.recipe.request: Add requestoptional.serialised

It is combination of requestoptional and serialised.
parent 8eb13ef2
......@@ -163,6 +163,8 @@ setup(name=name,
'request.serialised = slapos.recipe.request:RequestJSONEncoded',
'request.edge = slapos.recipe.request:RequestEdge',
'requestoptional = slapos.recipe.request:RequestOptional',
'requestoptional.serialised = '
'slapos.recipe.request:RequestOptionalJSONEncoded',
're6stnet.registry = slapos.recipe.re6stnet:Recipe',
'reverseproxy.nginx = slapos.recipe.reverse_proxy_nginx:Recipe',
'seleniumrunner = slapos.recipe.seleniumrunner:Recipe',
......
......@@ -280,6 +280,11 @@ class RequestJSONEncoded(JSONCodec, Recipe):
"""
pass
class RequestOptionalJSONEncoded(JSONCodec, RequestOptional):
"""
Like RequestOptional, but serialised with JSONCodec.
"""
pass
CONNECTION_PARAMETER_STRING = 'connection-'
......
......@@ -112,3 +112,10 @@ class RequestJSONEncodedTest(RecipeTestMixin, unittest.TestCase):
raises = True
called_partition_parameter_kw = {'_': '{}'}
class RequestOptionalJSONEncodedTest(RecipeTestMixin, unittest.TestCase):
recipe = request.RequestOptionalJSONEncoded
return_value_empty = "{}"
return_value = '{"anything": "done"}'
raises = False
called_partition_parameter_kw = {'_': '{}'}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment