Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 2e4d641

Browse files
authored
Merge pull request #137 from csantanapr/issue_131_authHandler
fix tests for new openwhisk client properties
2 parents dfccd24 + d8046b3 commit 2e4d641

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"jszip": "^3.1.3",
3838
"lodash": "^4.17.4",
3939
"moment": "^2.16.0",
40-
"openwhisk": "^3.15.0"
40+
"openwhisk": "^3.18.0"
4141
},
4242
"devDependencies": {
4343
"chai-as-promised": "^6.0.0",

provider/tests/openwhiskProvider.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,38 +55,38 @@ describe('OpenwhiskProvider', () => {
5555

5656
describe('#client()', () => {
5757
it('should return pre-configured openwhisk client', () => {
58-
openwhiskProvider._client = null
58+
openwhiskProvider._client = null
5959
const creds = {apihost: 'some_api', auth: 'user:pass'}
6060
sandbox.stub(openwhiskProvider, "props").returns(BbPromise.resolve(creds))
6161
return openwhiskProvider.client().then(client => {
62-
expect(client.actions.client.options).to.be.deep.equal({apigwToken: undefined, apigwSpaceGuid: undefined, namespace: undefined, apiKey: creds.auth, ignoreCerts: false, api: `https://${creds.apihost}/api/v1/`})
62+
expect(client.actions.client.options).to.be.deep.equal({apigwToken: undefined, apigwSpaceGuid: undefined, namespace: undefined, apiKey: creds.auth, ignoreCerts: false, api: `https://${creds.apihost}/api/v1/`, authHandler: undefined, noUserAgent: undefined})
6363
expect(typeof openwhiskProvider._client).to.not.equal('undefined');
6464
})
6565
})
6666

6767
it('should allow ignore_certs options for openwhisk client', () => {
68-
openwhiskProvider._client = null
68+
openwhiskProvider._client = null
6969
const creds = {apihost: 'some_api', auth: 'user:pass'}
7070
sandbox.stub(openwhiskProvider, "props").returns(BbPromise.resolve(creds))
7171
openwhiskProvider.serverless.service.provider.ignore_certs = true
7272
return openwhiskProvider.client().then(client => {
73-
expect(client.actions.client.options).to.be.deep.equal({apigwToken: undefined, apigwSpaceGuid: undefined, namespace: undefined, apiKey: creds.auth, ignoreCerts: true, api: `https://${creds.apihost}/api/v1/`})
73+
expect(client.actions.client.options).to.be.deep.equal({apigwToken: undefined, apigwSpaceGuid: undefined, namespace: undefined, apiKey: creds.auth, ignoreCerts: true, api: `https://${creds.apihost}/api/v1/`, authHandler: undefined, noUserAgent: undefined})
7474
expect(typeof openwhiskProvider._client).to.not.equal('undefined');
7575
})
7676
})
7777

78-
it('should allow apigw_access_toekn option for openwhisk client', () => {
79-
openwhiskProvider._client = null
78+
it('should allow apigw_access_token option for openwhisk client', () => {
79+
openwhiskProvider._client = null
8080
const creds = {apihost: 'some_api', auth: 'user:pass', apigw_access_token: 'token'}
8181
sandbox.stub(openwhiskProvider, "props").returns(BbPromise.resolve(creds))
8282
return openwhiskProvider.client().then(client => {
83-
expect(client.actions.client.options).to.be.deep.equal({apigwToken: 'token', apigwSpaceGuid: 'user', namespace: undefined, apiKey: creds.auth, ignoreCerts: false, api: `https://${creds.apihost}/api/v1/`})
83+
expect(client.actions.client.options).to.be.deep.equal({apigwToken: 'token', apigwSpaceGuid: 'user', namespace: undefined, apiKey: creds.auth, ignoreCerts: false, api: `https://${creds.apihost}/api/v1/`, authHandler: undefined, noUserAgent: undefined})
8484
expect(typeof openwhiskProvider._client).to.not.equal('undefined');
8585
})
8686
})
8787

8888
it('should cache client instance', () => {
89-
openwhiskProvider._client = {}
89+
openwhiskProvider._client = {}
9090
return openwhiskProvider.client().then(client => {
9191
expect(client).to.be.equal(openwhiskProvider._client)
9292
})
@@ -95,7 +95,7 @@ describe('OpenwhiskProvider', () => {
9595

9696
describe('#props()', () => {
9797
it('should return promise that resolves with provider credentials', () => {
98-
openwhiskProvider._props = null
98+
openwhiskProvider._props = null
9999
const creds = {apihost: 'some_api', auth: 'user:pass', namespace: 'namespace'}
100100
sandbox.stub(Credentials, "getWskProps").returns(BbPromise.resolve(creds))
101101
return openwhiskProvider.props().then(props => {
@@ -105,7 +105,7 @@ describe('OpenwhiskProvider', () => {
105105
});
106106

107107
it('should return cached provider credentials', () => {
108-
openwhiskProvider._props = {}
108+
openwhiskProvider._props = {}
109109
const stub = sandbox.stub(Credentials, "getWskProps")
110110
return openwhiskProvider.props().then(props => {
111111
expect(props).to.be.equal(openwhiskProvider._props)
@@ -136,4 +136,4 @@ describe('OpenwhiskProvider', () => {
136136
return expect(() => openwhiskProvider.hasValidCreds(mockObject)).to.throw(/OW_APIHOST/);
137137
});
138138
})
139-
})
139+
})

0 commit comments

Comments
 (0)