-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cucumber test for header modifier filter
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...cumber-tests/src/test/resources/artifacts/apk-confs/request_and_response_filters.apk-conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
id: "api-with-request-and-response-filters" | ||
name: "EmployeeServiceAPI" | ||
basePath: "/request-and-response-filters" | ||
version: "3.14" | ||
type: "REST" | ||
defaultVersion: false | ||
endpointConfigurations: | ||
production: | ||
endpoint: "http://backend:80/anything" | ||
operations: | ||
- target: "/employee" | ||
verb: "GET" | ||
secured: false | ||
scopes: [] | ||
operationPolicies: | ||
request: | ||
- policyName: AddHeaders | ||
policyVersion: v1 | ||
parameters: | ||
headers: | ||
- name: "Test-Request-Header" | ||
value: "Test-Value" | ||
- policyName: SetHeaders | ||
policyVersion: v1 | ||
parameters: | ||
headers: | ||
- name: "Set-Request-Header" | ||
value: "Test-Value" | ||
- policyName: RemoveHeaders | ||
policyVersion: v1 | ||
parameters: | ||
headers: | ||
- "Authorization" | ||
response: | ||
- policyName: AddHeaders | ||
policyVersion: v1 | ||
parameters: | ||
headers: | ||
- name: "Test-Response-Header" | ||
value: "Test-Value" | ||
- policyName: SetHeaders | ||
policyVersion: v1 | ||
parameters: | ||
headers: | ||
- name: "Set-Response-Header" | ||
value: "Test-Value" | ||
- policyName: RemoveHeaders | ||
policyVersion: v1 | ||
parameters: | ||
headers: | ||
- "content-type" | ||
- target: "/employee" | ||
verb: "POST" | ||
secured: true | ||
scopes: [] | ||
- target: "/employee/{employeeId}" | ||
verb: "PUT" | ||
secured: true | ||
scopes: [] | ||
- target: "/employee/{employeeId}" | ||
verb: "DELETE" | ||
secured: true | ||
scopes: [] |
28 changes: 28 additions & 0 deletions
28
test/cucumber-tests/src/test/resources/tests/api/HTTPRouteFilters.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Feature: Test HTTPRoute Filter Header Modifier functionality | ||
Scenario: Test request and response header modification functionality | ||
Given The system is ready | ||
And I have a valid subscription | ||
When I use the APK Conf file "artifacts/apk-confs/request_and_response_filters.apk-conf" | ||
And the definition file "artifacts/definitions/employees_api.json" | ||
And make the API deployment request | ||
Then the response status code should be 200 | ||
Then I set headers | ||
| Authorization | bearer ${accessToken} | | ||
And I send "GET" request to "https://default.gw.wso2.com:9095/request-and-response-filters/3.14/employee/" with body "" | ||
And I eventually receive 200 response code, not accepting | ||
| 401 | | ||
And the response body should contain "\"Test-Request-Header\": \"Test-Value\"" | ||
And the response body should contain "\"Set-Request-Header\": \"Test-Value\"" | ||
And the response body should not contain "\"Authorization\"" | ||
Then the response headers contains key "Set-Response-Header" and value "Test-Value" | ||
Then the response headers contains key "Test-Response-Header" and value "Test-Value" | ||
And the response headers should not contain | ||
| content-type | | ||
|
||
Scenario: Undeploy the API | ||
Given The system is ready | ||
And I have a valid subscription | ||
When I undeploy the API whose ID is "api-with-request-and-response-filters" | ||
Then the response status code should be 202 | ||
|
||
|