本文整理汇总了Python中zato.server.service.reqresp.Request.channel_params["c"]方法的典型用法代码示例。如果您正苦于以下问题:Python Request.channel_params["c"]方法的具体用法?Python Request.channel_params["c"]怎么用?Python Request.channel_params["c"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zato.server.service.reqresp.Request
的用法示例。
在下文中一共展示了Request.channel_params["c"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_sio
# 需要导入模块: from zato.server.service.reqresp import Request [as 别名]
# 或者: from zato.server.service.reqresp.Request import channel_params["c"] [as 别名]
def test_init_sio(self):
is_sio = True
cid = uuid4().hex
data_format = uuid4().hex
transport = uuid4().hex
io_default = {}
io_custom = Bunch(
{
"request_elem": uuid4().hex,
"input_required": ["a", "b", "c"],
"input_optional": ["d", "e", "f"],
"default_value": uuid4().hex,
"use_text": uuid4().hex,
}
)
wsgi_environ = {
"zato.http.GET": {uuid4().hex: uuid4().hex},
"zato.http.POST": {uuid4().hex: uuid4().hex},
"REQUEST_METHOD": uuid4().hex,
}
def _get_params(request_params, *ignored):
# 'g' is never overridden
if request_params is io_custom["input_required"]:
return {"a": "a-req", "b": "b-req", "c": "c-req", "g": "g-msg"}
else:
return {"d": "d-opt", "e": "e-opt", "f": "f-opt", "g": "g-msg"}
r = Request(None)
r.payload = None
r.get_params = _get_params
r.channel_params["a"] = "channel_param_a"
r.channel_params["b"] = "channel_param_b"
r.channel_params["c"] = "channel_param_c"
r.channel_params["d"] = "channel_param_d"
r.channel_params["e"] = "channel_param_e"
r.channel_params["f"] = "channel_param_f"
r.channel_params["h"] = "channel_param_h" # Never overridden
for io in (io_default, io_custom):
for params_priority in PARAMS_PRIORITY:
r.params_priority = params_priority
r.init(is_sio, cid, io, data_format, transport, wsgi_environ)
if io is io_default:
eq_(
sorted(r.input.items()),
sorted(
{
"a": "channel_param_a",
"b": "channel_param_b",
"c": "channel_param_c",
"d": "channel_param_d",
"e": "channel_param_e",
"f": "channel_param_f",
"h": "channel_param_h",
}.items()
),
)
else:
if params_priority == PARAMS_PRIORITY.CHANNEL_PARAMS_OVER_MSG:
eq_(
sorted(r.input.items()),
sorted(
{
"a": "channel_param_a",
"b": "channel_param_b",
"c": "channel_param_c",
"d": "channel_param_d",
"e": "channel_param_e",
"f": "channel_param_f",
"g": "g-msg",
"h": "channel_param_h",
}.items()
),
)
else:
eq_(
sorted(r.input.items()),
sorted(
{
"a": "a-req",
"b": "b-req",
"c": "c-req",
"d": "d-opt",
"e": "e-opt",
"f": "f-opt",
"g": "g-msg",
"h": "channel_param_h",
}.items()
),
)