From 6bb8f974fb53d153c4ae1482e73697a5b2ba65ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Hurtado?= Date: Tue, 27 Aug 2019 09:44:37 +0200 Subject: [PATCH] Added features for data/handler/error_invalidresource, data/handler/error_notfound and data/handler/success --- .../handler/error_invalidresource.feature | 16 +++++++++++ .../data/handler/error_notfound.feature | 28 +++++++++++++++++++ .../features/data/handler/success.feature | 21 ++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 spec/test/features/data/handler/error_invalidresource.feature create mode 100644 spec/test/features/data/handler/error_notfound.feature create mode 100644 spec/test/features/data/handler/success.feature diff --git a/spec/test/features/data/handler/error_invalidresource.feature b/spec/test/features/data/handler/error_invalidresource.feature new file mode 100644 index 0000000..82553c1 --- /dev/null +++ b/spec/test/features/data/handler/error_invalidresource.feature @@ -0,0 +1,16 @@ +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. + + @wip + 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. + + 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 the get the resource "request/path" for the current request handler + 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_notfound.feature b/spec/test/features/data/handler/error_notfound.feature new file mode 100644 index 0000000..443a794 --- /dev/null +++ b/spec/test/features/data/handler/error_notfound.feature @@ -0,0 +1,28 @@ +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. + + @wip + 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. + + 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 the get the resource "request/path" for the handler with id HANDLER_ID_XXXXXXXXXX + Then I get 404 as response code + And I get "Not Found" as response reason phrase + + @wip + 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. + + 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 the get the resource "invented/path" for the handler with id HANDLER_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 new file mode 100644 index 0000000..1d933a3 --- /dev/null +++ b/spec/test/features/data/handler/success.feature @@ -0,0 +1,21 @@ +Feature: Retrieve a resource from a handler in Kapow! server. + Users can retrieve request handler resources + from the server by specifying the handler id + and the resource path. + + @wip + Scenario: Retrieve a resource for the current request. + 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 the get the resource "request/path" for the current request handler + Then I get 200 as response code + And I get "OK" as response reason phrase + And I get the following response body: + """ + /listRootDir + """