From 1dac4d41c8674b3f362d0278c10c4c1f05a49f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Hurtado?= Date: Wed, 21 Aug 2019 09:43:48 +0200 Subject: [PATCH] Replaced gherkin tables by json documents in requests and responses of append features --- .../append/error_unprocessable.feature | 38 ++++++++++++---- .../features/control/append/success.feature | 44 +++++++++++++++---- 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/spec/test/features/control/append/error_unprocessable.feature b/spec/test/features/control/append/error_unprocessable.feature index 933cf07..8e53802 100644 --- a/spec/test/features/control/append/error_unprocessable.feature +++ b/spec/test/features/control/append/error_unprocessable.feature @@ -10,13 +10,23 @@ Feature: Kapow! server reject responses with semantic errors. Given I have a running Kapow! server When I append the route: - | entrypoint | command | - | /bin/sh -c | ls -la / \| response /body | + """ + { + "entrypoint": "/bin/sh -c", + "command": "ls -la / | response /body" + } + """ Then I get 422 as response code And I get "Missing Mandatory Field" as response reason phrase And I get the following entity as response body: - | missing_mandatory_fields | - | "url_pattern", "method" | + """ + { + "missing_mandatory_fields": [ + "url_pattern", + "method" + ] + } + """ Scenario: Error because of wrong route specification. If a request contains an invalid expression in the @@ -24,8 +34,14 @@ Feature: Kapow! server reject responses with semantic errors. Given I have a running Kapow! server When I append the route: - | method | url_pattern | entrypoint | command | - | GET | +123-- | /bin/sh -c | ls -la / \| response /body | + """ + { + "method": "GET", + "url_pattern": "+123--", + "entrypoint": "/bin/sh -c", + "command": "ls -la / | response /body" + } + """ Then I get 422 as response code And I get "Invalid Route Spec" as response reason phrase And I get an empty response body @@ -36,8 +52,14 @@ Feature: Kapow! server reject responses with semantic errors. Given I have a running Kapow! server When I append the route: - | method | url_pattern | entrypoint | command | - | AVECES | +123-- | /bin/sh -c | ls -la / \| response /body | + """ + { + "method": "SOMETIMES", + "url_pattern": "/", + "entrypoint": "/bin/sh -c", + "command": "ls -la / | response /body" + } + """ Then I get 422 as response code And I get "Invalid Data Type" as response reason phrase And I get an empty response body diff --git a/spec/test/features/control/append/success.feature b/spec/test/features/control/append/success.feature index a048b17..d86a42c 100644 --- a/spec/test/features/control/append/success.feature +++ b/spec/test/features/control/append/success.feature @@ -9,13 +9,27 @@ Feature: Append new routes in Kapow! server. Given I have a just started Kapow! server When I append the route: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | + """ + { + "method": "GET", + "url_pattern": "/listRootDir", + "entrypoint": "/bin/sh -c", + "command": "ls -la / | response /body" + } + """ Then I get 201 as response code And I get "Created" as response reason phrase And I get the following entity as response body: - | method | url_pattern | entrypoint | command | index | id | - | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | 0 | * | + """ + { + "method": "GET", + "url_pattern": "/listRootDir", + "entrypoint": "/bin/sh -c", + "command": "ls -la / | response /body", + "index": 0, + "id": "*" + } + """ Scenario: Append another route. Appending routes on a non empty list will create new routes @@ -26,10 +40,24 @@ Feature: Append new routes in Kapow! server. | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | | GET | /listDir/{dirname} | /bin/sh -c | ls -la /request/params/dirname \| response /body | When I append the route: - | method | url_pattern | entrypoint | command | - | GET | /listEtcDir | /bin/sh -c | ls -la /etc \| response /body | + """ + { + "method": "GET", + "url_pattern": "/listEtcDir", + "entrypoint": "/bin/sh -c", + "command": "ls -la /etc | response /body" + } + """ Then I get 201 as response code And I get "Created" as response reason phrase And I get the following entity as response body: - | method | url_pattern | entrypoint | command | index | id | - | GET | /listEtcDir | /bin/sh -c | ls -la /etc \| response /body | 2 | * | + """ + { + "method": "GET", + "url_pattern": "/listEtcDir", + "entrypoint": "/bin/sh -c", + "command": "ls -la /etc | response /body", + "index": 2, + "id": "*" + } + """