Change response code from phrase to code and 'phrase' by 'reason phrase'

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-08-20 09:54:18 +02:00
parent 5352322ad5
commit 5e253c9814
7 changed files with 73 additions and 24 deletions
+49
View File
@@ -17,6 +17,7 @@ class Env(EnvironConfig):
@given('I have a just started Kapow! server')
@given('I have a running Kapow! server')
def step_impl(context):
context.server = subprocess.Popen(
Env.KAPOW_SERVER_CMD,
@@ -69,3 +70,51 @@ def step_impl(context):
assert header in entry, f"Response does not contain the key {header}"
if row[header] != '*':
assert entry[header] == row[header], f"Values mismatch"
#
#
#
@when('I append the route')
def step_impl(context):
if not hasattr(context, 'table'):
raise RuntimeError("A table must be set for this step.")
for row in context.table:
response = requests.post(f"{Env.KAPOW_CONTROLAPI_URL}/routes",
json={h: row[h] for h in row.headings})
response.raise_for_status()
@then('I get {code} as response code')
def step_impl(context, code):
raise NotImplementedError('STEP: Then I get unprocessable entity as response code')
@then('I get "{reason}" as response reason phrase')
def step_impl(context, reason):
raise NotImplementedError('STEP: Then I get "Missing Mandatory Field" as response phrase')
@then('I get the following entity as response body')
def step_impl(context):
raise NotImplementedError('STEP: Then I get the following entity as response body')
@then('I get an empty response body')
def step_impl(context):
raise NotImplementedError('STEP: Then I get an empty response body')
@when('I delete the route with id "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"')
def step_impl(context):
raise NotImplementedError('STEP: When I delete the route with id "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"')
@given('It has a route with id "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"')
def step_impl(context):
raise NotImplementedError('STEP: Given It has a route with id "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"')
@when('I insert the route')
def step_impl(context):
raise NotImplementedError('STEP: When I insert the route')