diff --git a/LICENSE b/LICENSE index 2da0b5e5d5bd883cf10af7a1e88d2fab2646a5b8..43af00e2b6f18255802ed944b29d250f6bde5aea 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,18 @@ +XFSC TSA Automation test + This repository holds the test automation framework based on Java and used for testing TSA and contains also the BDD scenarios. Copyright (c) 2023 Vereign AG [https://www.vereign.com] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java b/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java index 55162d1339d71c86dcfd96b1de2d43b749679747..3db0824a4f041d45daa57cbfa607650db8797c25 100644 --- a/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java +++ b/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java @@ -64,12 +64,14 @@ public class PolicyStepDefinitions extends BaseStepDefinitions { } @When( - "^I request the Policy Admin API with parameters locked \\{(.*)\\}, rego \\{(.*)\\}, data \\{(.*)\\}, dataConfig\\{(.*)\\}$") + "^I request the Policy Admin API with parameters locked \\{(.*)\\}, policy name \\{(.*)\\}, rego \\{(.*)\\}, data \\{(.*)\\}, dataConfig\\{(.*)\\}$") public void iRequestThePolicyAdminAPIWithParametersLockedRegoDataDataConfig( - String locked, String rego, String data, String dataConfig) { + String locked, String policyName, String rego, String data, String dataConfig) { currentRequest.setPath( "/v1/policies?locked=" + locked + + "&policyName=" + + policyName + "®o=" + rego + "&data=" diff --git a/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/policies/GET.feature b/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/policies/GET.feature index 645ae74c1effe197ad74013dec053dd386cc8fbb..a3b91d86414df0fdc11223831ed12673521f3705 100644 --- a/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/policies/GET.feature +++ b/src/test/resources/features/tsa/policy/policy/{respository}/{group}/{name}/{version}/policies/GET.feature @@ -24,7 +24,7 @@ Feature: API - TSA - policy - {repository}/{group}/{name}/{version}/policy GET And the field {policies[*].locked} contains the value {false} Scenario: TSA - Export all locked policies - Positive - When I request the Policy Admin API with parameters locked {true}, rego {false}, data {false}, dataConfig{false} + When I request the Policy Admin API with parameters locked {true}, policy name {}, rego {false}, data {false}, dataConfig{false} Then the status code should be {200} And the field {policies[*].repository} contains the value {policies} And the field {policies[*].policyName} contains the value {locked} @@ -32,8 +32,17 @@ Feature: API - TSA - policy - {repository}/{group}/{name}/{version}/policy GET And the field {policies[*].version} contains the value {1.0} And the field {policies[*].locked} contains the value {true} + Scenario: TSA - Export specific policy - Positive + When I request the Policy Admin API with parameters locked {}, policy name {didResolve}, rego {true}, data {}, dataConfig{} + Then the status code should be {200} + And the field {policies[*].repository} contains the value {policies} + And the field {policies[*].policyName} contains the value {didResolve} + And the field {policies[*].group} contains the value {example} + And the field {policies[*].version} contains the value {1.0} + And the field {policies[*].locked} contains the value {false} + Scenario: TSA - Export all locked policies and include the REGO field - Positive - When I request the Policy Admin API with parameters locked {true}, rego {true}, data {false}, dataConfig{false} + When I request the Policy Admin API with parameters locked {true}, policy name {}, rego {true}, data {false}, dataConfig{false} Then the status code should be {200} And the field {policies[*].repository} contains the value {policies} And the field {policies[*].policyName} contains the value {locked} @@ -43,7 +52,7 @@ Feature: API - TSA - policy - {repository}/{group}/{name}/{version}/policy GET And the field {policies[*].locked} contains the value {true} Scenario: TSA - Export all locked policies and include the REGO, data and dataConfig fields - Positive - When I request the Policy Admin API with parameters locked {true}, rego {true}, data {true}, dataConfig{true} + When I request the Policy Admin API with parameters locked {true}, policy name {}, rego {true}, data {true}, dataConfig{true} Then the status code should be {200} And the field {policies[*].repository} contains the value {policies} And the field {policies[*].policyName} contains the value {locked} @@ -55,7 +64,7 @@ Feature: API - TSA - policy - {repository}/{group}/{name}/{version}/policy GET And the field {policies[*].locked} contains the value {true} Scenario: TSA - Export all policies and include the REGO, data and dataConfig fields - Positive - When I request the Policy Admin API with parameters locked {false}, rego {true}, data {true}, dataConfig{true} + When I request the Policy Admin API with parameters locked {false}, policy name {}, rego {true}, data {true}, dataConfig{true} Then the status code should be {200} And the field {policies[*].repository} contains the value {policies} And the field {policies[*].policyName} contains the value {returnDID} @@ -67,24 +76,30 @@ Feature: API - TSA - policy - {repository}/{group}/{name}/{version}/policy GET @negative Scenario: TSA - Export all policies with wrong value for locked parameter - Negative - When I request the Policy Admin API with parameters locked {notBoolean}, rego {true}, data {true}, dataConfig{true} + When I request the Policy Admin API with parameters locked {notBoolean}, policy name {}, rego {true}, data {true}, dataConfig{true} Then the status code should be {400} And the field {message} has the value {invalid value "notBoolean" for "locked", must be a boolean} @negative Scenario: TSA - Export all policies with wrong value for REGO parameter - Negative - When I request the Policy Admin API with parameters locked {false}, rego {notBoolean}, data {true}, dataConfig{true} + When I request the Policy Admin API with parameters locked {false}, policy name {}, rego {notBoolean}, data {true}, dataConfig{true} Then the status code should be {400} And the field {message} has the value {invalid value "notBoolean" for "rego", must be a boolean} @negative Scenario: TSA - Export all policies with wrong value for data parameter - Negative - When I request the Policy Admin API with parameters locked {false}, rego {true}, data {notBoolean}, dataConfig{true} + When I request the Policy Admin API with parameters locked {false}, policy name {}, rego {true}, data {notBoolean}, dataConfig{true} Then the status code should be {400} And the field {message} has the value {invalid value "notBoolean" for "data", must be a boolean} @negative Scenario: TSA - Export all policies with wrong value for dataConfig parameter - Negative - When I request the Policy Admin API with parameters locked {false}, rego {true}, data {true}, dataConfig{notBoolean} + When I request the Policy Admin API with parameters locked {false}, policy name {}, rego {true}, data {true}, dataConfig{notBoolean} Then the status code should be {400} - And the field {message} has the value {invalid value "notBoolean" for "dataConfig", must be a boolean} \ No newline at end of file + And the field {message} has the value {invalid value "notBoolean" for "dataConfig", must be a boolean} + + @negative + Scenario: TSA - Export specific non existing policy - Positive + When I request the Policy Admin API with parameters locked {}, policy name {nonExistingPolicy}, rego {true}, data {}, dataConfig{} + Then the status code should be {200} + And the field {policies} contains the value {}