diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/poc/.gitignore b/poc/.gitignore new file mode 100644 index 0000000..59d5265 --- /dev/null +++ b/poc/.gitignore @@ -0,0 +1,2 @@ +build +*.egg-info diff --git a/spec/test/features/data/handler/error_invalidresource.feature b/spec/test/features/data/handler/error_invalidresource.feature index 80ae430..6541c1a 100644 --- a/spec/test/features/data/handler/error_invalidresource.feature +++ b/spec/test/features/data/handler/error_invalidresource.feature @@ -1,16 +1,16 @@ -@wip -Feature: Fail to retrieve an invalid resource for a handler in Kapow! server. - If trying to access an invalid resource for a handler - then the server responds with an error. +Feature: Fail to retrieve invalid resources from a handler in Kapow! server. + If trying to access an invalid resource from + a handler then the server responds with an + error. - Scenario: Try to get invented/path from a existent handler. - A request for retrieving an invalid resource for an - existent handler will trigger a invalid resource error. + Scenario: Try to get an inexistent resource from a handler. + A request to retrieve an invalid resource + from a handler will trigger a invalid resource error. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | - When I send a request to the route "/listRootDir" - And I get the resource "request/path" for the current request handler + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir | + When I send a request to the testing route "/listRootDir" + And I get the resource "invented/path" Then I get 400 as response code And I get "Invalid Resource Path" as response reason phrase diff --git a/spec/test/features/data/handler/error_itemnotfound.feature b/spec/test/features/data/handler/error_itemnotfound.feature new file mode 100644 index 0000000..791538b --- /dev/null +++ b/spec/test/features/data/handler/error_itemnotfound.feature @@ -0,0 +1,16 @@ +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. + + Scenario: Try to get a nonexistent resource item from a handler. + A request to retrieve a nonexistent resource + item from a handler will trigger a no content + error. + + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir | + When I send a request to the testing route "/listRootDir" + And I get the resource "request/params/meloinvento" + Then I get 204 as response code + And I get "Resource Item Not Found" as response reason phrase diff --git a/spec/test/features/data/handler/error_notfound.feature b/spec/test/features/data/handler/error_notfound.feature index 87e5992..5bc031b 100644 --- a/spec/test/features/data/handler/error_notfound.feature +++ b/spec/test/features/data/handler/error_notfound.feature @@ -1,27 +1,24 @@ -@wip -Feature: Fail to retrieve resources from nonexistent handler in Kapow! server. - If trying to access a nonexistent handler then the - server responds with a noptfound error. +Feature: Fail to retrieve resources from a nonexistent handler in Kapow! server. + If trying to access a nonexistent handler then + the server responds with a not found error. - Scenario: Try to get a valid resource from a nonexistent handler. - A request for retrieving a resource from a nonexistent - handler will trigger a not found error. + Scenario: Try to get a valid resource path from a nonexistent handler. + A request to retrieve a resource from a + nonexistent handler will trigger a not found + error. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | + Given I have a running Kapow! server 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 - Scenario: Fail to get an invalid resource from a nonexistent handler. - A request for retrieving a resource from a nonexistent - handler will trigger a not found error even if the - resource is invalid. + Scenario: Try to get an invalid resource from a nonexistent handler. + A request to retrieve an invalid resource + from a nonexistent handler will trigger a + not found error even if the resource is + invalid. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | - When I get the resource "invented/path" for the handler with id XXXXXXXXXX + Given I have a running Kapow! server + 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 diff --git a/spec/test/features/data/handler/success.feature b/spec/test/features/data/handler/success.feature index ba715ec..27f0d51 100644 --- a/spec/test/features/data/handler/success.feature +++ b/spec/test/features/data/handler/success.feature @@ -1,21 +1,36 @@ -@wip -Feature: Retrieve a resource from a handler in Kapow! server. - Users can retrieve request handler resources - from the server by specifying the handler id +Feature: Retrieve a handler resource in Kapow! server. + Users can retrieve handler resources from + the server by specifying the handler id and the resource path. - Scenario: Retrieve a resource for the current request. + Scenario: Retrieve a resource. Get the "request/path" resource for the current request through the handler id. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | - When I send a request to the route "/listRootDir" - And I get the resource "request/path" for the current request handler + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir | + When I send a request to the testing route "/listRootDir" + 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 body: + And I get the following response raw body: """ /listRootDir """ + + Scenario: Retrieve a resource item. + Get the "request/headers/Host" item resource for + the current request through the handler id. + + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir | + When I send a request to the testing route "/listRootDir" + 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: + """ + localhost:8080 + """