From 303ec07901af3798efc873cbe050aa5cb4ba7655 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 8 Jul 2014 11:00:40 +0200 Subject: use cucumber; initial ConfigsController --- features/config.feature | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 features/config.feature (limited to 'features/config.feature') diff --git a/features/config.feature b/features/config.feature new file mode 100644 index 0000000..2d237f2 --- /dev/null +++ b/features/config.feature @@ -0,0 +1,39 @@ +Feature: Download Provider Configuration + + The LEAP Provider exposes parts of its configuration through the API. + + This can be used to find out about services offered. The big picture can be retrieved from `/provider.json`. More detailed settings of the services are available after authentication. You can get a list of the available settings from `/1/configs.json`. + + Background: + Given I set headers: + | Accept | application/json | + | Content-Type | application/json | + + @tempfile + Scenario: Fetch provider config + Given the provider config is: + """ + {"config": "me"} + """ + When I send a GET request to "/provider.json" + Then the response status should be "200" + And the response should be: + """ + {"config": "me"} + """ + + Scenario: Missing provider config + When I send a GET request to "/provider.json" + Then the response status should be "404" + And the response should be: + """ + {"error": "not found"} + """ + + Scenario: Authentication required for list of configs + When I send a GET request to "/1/configs" + Then the response status should be "401" + And the response should be: + """ + {"error": "Please log in to perform that action."} + """ -- cgit v1.2.3 From f1a8cefb810bef263d3a96edffbec511dbe15291 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 8 Jul 2014 12:48:33 +0200 Subject: send static list of configs for now Also added authentication steps to cucumber --- features/config.feature | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'features/config.feature') diff --git a/features/config.feature b/features/config.feature index 2d237f2..f53d0bf 100644 --- a/features/config.feature +++ b/features/config.feature @@ -37,3 +37,20 @@ Feature: Download Provider Configuration """ {"error": "Please log in to perform that action."} """ + + Scenario: Fetch list of available configs + Given I authenticated + And I set headers: + | Authorization | Token token="MY_AUTH_TOKEN" | + When I send a GET request to "/1/configs.json" + Then the response status should be "200" + And the response should be: + """ + { + "services": { + "soledad": "/1/configs/soledad-service.json", + "eip": "/1/configs/eip-service.json", + "smtp": "/1/configs/smtp-service.json" + } + } + """ -- cgit v1.2.3 From 091793265e23452890c6ca27fc64feb54df2ad0b Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 8 Jul 2014 19:08:39 +0200 Subject: move unauthenticated api endpoints into separate feature --- features/config.feature | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'features/config.feature') diff --git a/features/config.feature b/features/config.feature index f53d0bf..6e6c429 100644 --- a/features/config.feature +++ b/features/config.feature @@ -2,12 +2,16 @@ Feature: Download Provider Configuration The LEAP Provider exposes parts of its configuration through the API. - This can be used to find out about services offered. The big picture can be retrieved from `/provider.json`. More detailed settings of the services are available after authentication. You can get a list of the available settings from `/1/configs.json`. + This can be used to find out about services offered. The big picture can be retrieved from `/provider.json`. Which is available without authentication (see unauthenticated.feature). + + More detailed settings of the services are available after authentication. You can get a list of the available settings from `/1/configs.json`. Background: + Given I authenticated Given I set headers: | Accept | application/json | | Content-Type | application/json | + | Authorization | Token token="MY_AUTH_TOKEN" | @tempfile Scenario: Fetch provider config @@ -30,18 +34,7 @@ Feature: Download Provider Configuration {"error": "not found"} """ - Scenario: Authentication required for list of configs - When I send a GET request to "/1/configs" - Then the response status should be "401" - And the response should be: - """ - {"error": "Please log in to perform that action."} - """ - Scenario: Fetch list of available configs - Given I authenticated - And I set headers: - | Authorization | Token token="MY_AUTH_TOKEN" | When I send a GET request to "/1/configs.json" Then the response status should be "200" And the response should be: -- cgit v1.2.3 From bb10a669e1129c662ba01f223bd5a0ee7f2a0344 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 14 Jul 2014 18:00:14 +0200 Subject: fix controller refactor and features Also save debug log on failing features --- features/config.feature | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'features/config.feature') diff --git a/features/config.feature b/features/config.feature index 6e6c429..066d4c4 100644 --- a/features/config.feature +++ b/features/config.feature @@ -29,10 +29,7 @@ Feature: Download Provider Configuration Scenario: Missing provider config When I send a GET request to "/provider.json" Then the response status should be "404" - And the response should be: - """ - {"error": "not found"} - """ + And the response should have ".error" with the text "not_found" Scenario: Fetch list of available configs When I send a GET request to "/1/configs.json" -- cgit v1.2.3 From e86cccb4b89540f3bd403110d051b2723be781b9 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 17 Jul 2014 11:55:31 +0200 Subject: cuke: drop jsonpath, use simple keys instead Also fixed the test for login_required --- features/config.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features/config.feature') diff --git a/features/config.feature b/features/config.feature index 066d4c4..6adaed9 100644 --- a/features/config.feature +++ b/features/config.feature @@ -29,7 +29,7 @@ Feature: Download Provider Configuration Scenario: Missing provider config When I send a GET request to "/provider.json" Then the response status should be "404" - And the response should have ".error" with the text "not_found" + And the response should have "error" with "not_found" Scenario: Fetch list of available configs When I send a GET request to "/1/configs.json" -- cgit v1.2.3