Skip to content

Commit

Permalink
fix: re-enable test
Browse files Browse the repository at this point in the history
- security test was left commented

Contributes to: strimzi#106

Signed-off-by: Nic Townsend <[email protected]>
  • Loading branch information
nictownsend committed Dec 9, 2020
1 parent f1d9603 commit c3037ce
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
16 changes: 8 additions & 8 deletions server/client/client.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ Feature: client module
When I make a 'get' request to '/index.html'
Then the file is returned as with the expected configuration included

Scenario Outline: If assets can be served without authentication, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
Scenario Outline: With no authentication, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
Given a server with a 'client' configuration
And There are files to serve
And authentication type 'none' is required
And I run an instance of the Strimzi-UI server
When I make a 'get' request to '<Asset>'
Then I get the expected status code '<StatusCode>' response
# if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response
# if the route (not file) is not matched, we redirect to /. Hence /someroute response
Examples:
| Asset | StatusCode |
| /index.html | 200 |
Expand All @@ -45,14 +45,14 @@ Feature: client module
| /protected.html | 200 |
| / | 200 |

Scenario Outline: If assets can be served with authentication, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
Scenario Outline: With scram authentication, the client module returns the appropriate <StatusCode> return code for an unauthenticated request of <Asset>
Given a server with a 'client' configuration
And There are files to serve
And authentication type 'scram' is required
And I run an instance of the Strimzi-UI server
When I make a 'get' request to '<Asset>'
Then I get the expected status code '<StatusCode>' response
# if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response
# if the route is protected we redirect to login, and if the route isn't matched we redirect to /
Examples:
| Asset | StatusCode |
| /index.html | 302 |
Expand All @@ -63,18 +63,18 @@ Feature: client module
| / | 302 |


Scenario Outline: If assets can be served with authentication, the client module returns the appropriate <StatusCode> return code for a request of <Asset> when I am logged in
Scenario Outline: With scram authentication, the client module returns the appropriate <StatusCode> return code for an authenticated request of <Asset> when I am logged in
Given a server with a 'client' configuration
And a 'security' module
And There are files to serve
And authentication type 'scram' is required
And a scram user is valid
And the scram authentication accepts credentials
And I run an instance of the Strimzi-UI server
And all requests use the same session
When I send credentials to endpoint '/auth/login'
When I make a 'get' request to '<Asset>'
And I make a 'get' request to '<Asset>'
Then I get the expected status code '<StatusCode>' response
# if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response
# if the route (not file) is not matched, we redirect to /. Hence /someroute response
Examples:
| Asset | StatusCode |
| /index.html | 200 |
Expand Down
14 changes: 7 additions & 7 deletions server/security/security.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Feature: Security module
Scenario: SCRAM - authenticate valid credentials

Given a server with a 'security' configuration
# And authentication type 'scram' is required
# And I run an instance of the Strimzi-UI server
# And a scram user is valid
# When I send credentials to endpoint '/auth/login'
# Then I get the expected status code '200' response
And authentication type 'scram' is required
And I run an instance of the Strimzi-UI server
And the scram authentication accepts credentials
When I send credentials to endpoint '/auth/login'
Then I get the expected status code '200' response

Scenario: SCRAM - authenticate invalid credentials

Given a server with a 'security' configuration
And authentication type 'scram' is required
And I run an instance of the Strimzi-UI server
And a scram user is invalid
And the scram authentication rejects credentials
When I send credentials to endpoint '/auth/login'
Then I get the expected status code '401' response

Expand All @@ -33,7 +33,7 @@ Feature: Security module
Given a server with a 'security' configuration
And authentication type 'scram' is required
And I run an instance of the Strimzi-UI server
And a scram user is valid
And the scram authentication accepts credentials
When I make a 'post' request to '/auth/logout'
Then I get the expected status code '200' response

Expand Down
13 changes: 8 additions & 5 deletions server/test_common/commonServerSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ And(
})
);

When(
const httpRequest: [RegExp, CallBack] = [
/^I make a '(.+)' request to '(.+)'$/,
stepWhichUpdatesWorld(async (world, method, endpoint) => {
const { server } = world;
Expand All @@ -165,8 +165,11 @@ When(
...world,
request: server[method as string](endpoint),
};
})
);
}),
];

When.call(null, ...httpRequest);
And.call(null, ...httpRequest);

When(
/^I make a '(.+)' gql request to '(.+)'$/,
Expand Down Expand Up @@ -277,14 +280,14 @@ Then(
);

And(
'a scram user is valid',
'the scram authentication accepts credentials',
stepWithWorld((world) => {
const { hostname, contextRoot, port } = world.configuration.proxy;
nock(`http://${hostname}:${port}`).post(contextRoot).reply(200, {});
})
);
And(
'a scram user is invalid',
'the scram authentication rejects credentials',
stepWithWorld((world) => {
const { hostname, contextRoot, port } = world.configuration.proxy;
nock(`http://${hostname}:${port}`)
Expand Down

0 comments on commit c3037ce

Please sign in to comment.