Skip to content

Commit

Permalink
updated tests to latest changes in authkey system
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz committed Aug 2, 2017
1 parent 0b20dde commit 0a73f51
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions web/client/libs/__tests__/ajax-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ const authenticationRules = [
},
{
"urlPattern": ".*youhavetouseacustomone.*",
"method": {
"method": "authkey-param",
"param": "mario"
}
"authkeyParamName": "mario",
"method": "authkey"
},
{
"urlPattern": ".*thisismissingtheparam.*",
Expand Down Expand Up @@ -268,20 +266,6 @@ describe('Tests ajax library', () => {
});
});

it('falls back to standard authkey if the custom one is misconfigured', (done) => {
// mocking the authentication rules and user info
expect.spyOn(SecurityUtils, 'isAuthenticationActivated').andReturn(true);
expect.spyOn(SecurityUtils, 'getAuthenticationRules').andReturn(authenticationRules);
expect.spyOn(SecurityUtils, 'getSecurityInfo').andReturn(securityInfoB);
const theExpectedString = 'authkey%3D' + securityInfoB.token;
axios.get('http://non-existent.mapstore2/thisismissingtheparam?parameter1=value1&par2=v2').then(() => {
done("Axios actually reached the fake url");
}).catch((exception) => {
expect(exception.config).toExist().toIncludeKey('url');
expect(exception.config.url.indexOf(theExpectedString)).toBeGreaterThan(-1);
done();
});
});

it('does not add autkeys if the configuration is wrong', (done) => {
// mocking the authentication rules and user info
Expand Down

0 comments on commit 0a73f51

Please sign in to comment.