Skip to content

Commit

Permalink
Update cucumber test for scope validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sgayangi committed Apr 16, 2024
1 parent de809ef commit 7a5ba74
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ operations:
- target: "/employeewithoutscope"
verb: "GET"
scopes: []
- target: "/employeewithscope"
- target: "/employeewithscope1"
verb: "GET"
scopes:
- "wso2"
- "scope1"
- target: "/employeewithscope2"
verb: "GET"
scopes:
- "scope2"
- target: "/employeewithscopes"
verb: "GET"
scopes: ["scope1", "scope2"]
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Feature: API Deployment and invocation
And make the API deployment request
Then the response status code should be 200
Then I set headers
|Authorization|bearer ${accessToken}|
| Authorization | bearer ${accessToken} |
And I send "GET" request to "https://default.gw.wso2.com:9095/test/3.14/employee/" with body ""
And I eventually receive 200 response code, not accepting
|429|
| 429 |
And I send "POST" request to "https://default.gw.wso2.com:9095/test/3.14/employee/" with body ""
And the response status code should be 200
And I send "POST" request to "https://default.gw.wso2.com:9095/test/3.14/test/" with body ""
Expand All @@ -20,7 +20,7 @@ Feature: API Deployment and invocation
And I send "DELETE" request to "https://default.gw.wso2.com:9095/test/3.14/employee/12" with body ""
And the response status code should be 200
Then I set headers
|Authorization|bearer invalidToken|
| Authorization | bearer invalidToken |
And I send "GET" request to "https://default.gw.wso2.com:9095/test/3.14/employee/" with body ""
And the response status code should be 401
And I send "POST" request to "https://default.gw.wso2.com:9095/test/3.14/employee/" with body ""
Expand All @@ -42,14 +42,14 @@ Feature: API Deployment and invocation
And make the API deployment request
Then the response status code should be 200
Then I set headers
|Authorization|bearer ${accessToken}|
| Authorization | bearer ${accessToken} |
And I wait for next minute
And I send "GET" request to "https://default.gw.wso2.com:9095/test-version/1.0/employee/" with body ""
And I eventually receive 200 response code, not accepting
|429|
| 429 |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-version/2.0/employee/" with body ""
And I eventually receive 200 response code, not accepting
|429|
| 429 |

Scenario: Deploying an API with default version
Given The system is ready
Expand All @@ -59,10 +59,10 @@ Feature: API Deployment and invocation
And make the API deployment request
Then the response status code should be 200
Then I set headers
|Authorization|bearer ${accessToken}|
| Authorization | bearer ${accessToken} |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-default/3.14/employee/" with body ""
And I eventually receive 200 response code, not accepting
|429|
| 429 |
And I send "POST" request to "https://default.gw.wso2.com:9095/test-default/3.14/employee/" with body ""
And the response status code should be 200
And I send "POST" request to "https://default.gw.wso2.com:9095/test-default/3.14/test/" with body ""
Expand All @@ -71,10 +71,9 @@ Feature: API Deployment and invocation
And the response status code should be 200
And I send "DELETE" request to "https://default.gw.wso2.com:9095/test-default/3.14/employee/12" with body ""
And the response status code should be 200

And I send "GET" request to "https://default.gw.wso2.com:9095/test-default/employee/" with body ""
And I eventually receive 200 response code, not accepting
|429|
| 429 |
And I send "POST" request to "https://default.gw.wso2.com:9095/test-default/employee/" with body ""
And the response status code should be 200
And I send "POST" request to "https://default.gw.wso2.com:9095/test-default/test/" with body ""
Expand All @@ -92,22 +91,37 @@ Feature: API Deployment and invocation
And make the API deployment request
Then the response status code should be 200
Then I set headers
|Authorization|bearer ${accessToken}|
| Authorization | bearer ${accessToken} |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithoutscope/" with body ""
And I eventually receive 200 response code, not accepting
|429|
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscope/" with body ""
| 429 |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscope1/" with body ""
And the response status code should be 403
Given I have a valid subscription with scopes
|wso2|
| scope1 |
Then I set headers
|Authorization|bearer ${accessToken}|
| Authorization | bearer ${accessToken} |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithoutscope/" with body ""
And I eventually receive 200 response code, not accepting
|429|
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscope/" with body ""
| 429 |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscope1/" with body ""
And I eventually receive 200 response code, not accepting
|429|
| 429 |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscope2/" with body ""
And I eventually receive 403 response code, not accepting
| 200 |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscopes/" with body ""
And I eventually receive 403 response code, not accepting
| 429 |
Given I have a valid subscription with scopes
| scope1 |
| scope2 |
Then I set headers
| Authorization | bearer ${accessToken} |
And I send "GET" request to "https://default.gw.wso2.com:9095/test-scope/1.0.0/employeewithscopes/" with body ""
And I eventually receive 200 response code, not accepting
| 429 |


Scenario Outline: Undeploy API
Given The system is ready
Expand All @@ -116,9 +130,9 @@ Feature: API Deployment and invocation
Then the response status code should be <expectedStatusCode>

Examples:
| apiID | expectedStatusCode |
| f7996dce4ac15e2af0f8ee14546c4f72988eddae | 202 |
| default-version-api-test | 202 |
| emp-api-test-scope | 202 |
| version-api-test | 202 |
| version-api-test2 | 202 |
| apiID | expectedStatusCode |
| f7996dce4ac15e2af0f8ee14546c4f72988eddae | 202 |
| default-version-api-test | 202 |
| emp-api-test-scope | 202 |
| version-api-test | 202 |
| version-api-test2 | 202 |

0 comments on commit 7a5ba74

Please sign in to comment.