Skip to content
Snippets Groups Projects
Verified Commit edfb7b90 authored by Mark's avatar Mark
Browse files

Change value from json functions

parent 0a5c5e9a
No related branches found
No related tags found
1 merge request!5Service Integration
Pipeline #1440 failed with stages
in 1 minute and 45 seconds
......@@ -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]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment