Skip to content
Snippets Groups Projects
Commit 5b3917a0 authored by Rosen Georgiev's avatar Rosen Georgiev
Browse files

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

Resolve "[Test] Policy Admin API"

Closes #14

See merge request eclipse/xfsc/tsa/tests!27
parents af304c57 dd7ce6e4
No related branches found
No related tags found
1 merge request!64Remove explicit key parameters
......@@ -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.
Finish editing this message first!
Please register or to comment