Skip to content
Snippets Groups Projects
Commit 6626233e authored by Georgi Michev's avatar Georgi Michev
Browse files

Merge branch '14-test-policy-admin-api' into 'main'

Add tests for query policy with named filter

Closes #6

See merge request !63
parents de337369 dd7ce6e4
Branches
No related tags found
1 merge request!63Add tests for query policy with named filter
Pipeline #69786 passed
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.
......@@ -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
+ "&rego="
+ rego
+ "&data="
......
......@@ -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 {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment