Implemented step definitions for data/handler/error_notfound feature. Changed resource paths in data features to be prefixed by /

This commit is contained in:
Héctor Hurtado
2019-08-30 12:56:53 +02:00
parent 0535f66c85
commit 4e3470afa0
5 changed files with 11 additions and 8 deletions
@@ -1,4 +1,3 @@
@wip
Feature: Fail to retrieve nonexistent resource items in Kapow! server.
If trying to access a nonexistent resource item
then the server responds with a no content error.
@@ -8,7 +8,7 @@ Feature: Fail to retrieve resources from nonexistent handler in Kapow! server.
error.
Given I have a running Kapow! server
When I get the resource "request/path" for the handler with id XXXXXXXXXX
When I get the resource "/request/path" for the handler with id "XXXXXXXXXX"
Then I get 404 as response code
And I get "Not Found" as response reason phrase
@@ -19,6 +19,6 @@ Feature: Fail to retrieve resources from nonexistent handler in Kapow! server.
invalid.
Given I have a running Kapow! server
When I get the resource "invalid/path" for the handler with id XXXXXXXXXX
When I get the resource "/invalid/path" for the handler with id "XXXXXXXXXX"
Then I get 404 as response code
And I get "Not Found" as response reason phrase
@@ -12,7 +12,7 @@ Feature: Retrieve a resource from a handler in Kapow! server.
| method | url_pattern |
| GET | /listRootDir |
When I send a request to the testing route "/listRootDir"
And I get the resource "request/path"
And I get the resource "/request/path"
Then I get 200 as response code
And I get "OK" as response reason phrase
And I get the following response raw body:
@@ -28,7 +28,7 @@ Feature: Retrieve a resource from a handler in Kapow! server.
| method | url_pattern |
| GET | /listRootDir |
When I send a request to the testing route "/listRootDir"
And I get the resource "request/headers/Host"
And I get the resource "/request/headers/Host"
Then I get 200 as response code
And I get "OK" as response reason phrase
And I get the following response raw body:
@@ -11,7 +11,7 @@ Feature: Setting values for handler response resources in Kapow! server.
| method | url_pattern |
| GET | /listRootDir |
When I send a request to the testing route "/listRootDir"
And I set the resource "response/status" with value "418"
And I set the resource "/response/status" with value "418"
And I release the testing request
Then I get 418 as response code
+6 -2
View File
@@ -231,9 +231,13 @@ def step_impl(context, order):
@when('I get the resource "{resource}"')
def step_impl(context, resource):
@when('I get the resource "{resource}" for the handler with id "{handler_id}"')
def step_impl(context, resource, handler_id=None):
if handler_id is None:
handler_id = context.testing_handler_id
context.response = requests.get(
f"{Env.KAPOW_DATAAPI_URL}/handlers/{context.testing_handler_id}{resource}")
f"{Env.KAPOW_DATAAPI_URL}/handlers/{handler_id}{resource}")
@when('I set the resource "{resource}" with value "{value}"')