diff --git a/test/login_logout/test/behave/features/steps/login.py b/test/login_logout/test/behave/features/steps/login.py index ef1a5a5b2306a78cd7b3d37b1b7abe485a851bb9..4be73552ca95064a017dd68b060e1ffdb87886c4 100644 --- a/test/login_logout/test/behave/features/steps/login.py +++ b/test/login_logout/test/behave/features/steps/login.py @@ -32,15 +32,13 @@ def step_impl(context, element, variable): @then(u'I expect that the "{variable}" in the json output is "{value}"') def step_impl(context, variable, value): - obj = get_object_from_json_body(context) - assert obj[variable] == context.oauth[value] + assert context.oauth[value] == get_value_from_json_body(context, variable) @then(u'I expect that the "{variable}" in the json output contains "{value}"') def step_impl(context, variable, value): - obj = get_object_from_json_body(context) - assert context.oauth[value] in obj[variable] + assert context.oauth[value] in get_value_from_json_body(context, variable) -def get_object_from_json_body(context): +def get_value_from_json_body(context, key): obj_serialized = context.behave_driver.get_element("body").text - return json.loads(obj_serialized) + return json.loads(obj_serialized)[key]