Skip to content
Snippets Groups Projects

Resolve "Add login panel CI/CD to create (docker) image"

9 files
+ 10
254
Compare changes
  • Side-by-side
  • Inline
Files
9
"""Custom steps for tests that anaylize a website that returns a json object."""
import json
from behave import given, when, then
from behave_webdriver.steps import *
@then(u'I expect that the "{variable}" in the json output is the same as oauth variable "{value}"')
def step_impl(context, variable, value):
assert context.oauth[value] == get_value_from_json_body(context, variable)
@then(u'I expect that the "{variable}" in the json output is "{value}"')
def step_impl(context, variable, value):
assert value == get_value_from_json_body(context, variable)
@then(u'I expect that the "{variable}" in the json output contains the value of oauth variable "{value}"')
def step_impl(context, variable, value):
assert context.oauth[value] in 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):
assert value in get_value_from_json_body(context, variable)
def get_value_from_json_body(context, key):
obj_serialized = context.behave_driver.get_element("body").text
return json.loads(obj_serialized)[key]
Loading