akamai-edgegrid 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/helpers.js ADDED
@@ -0,0 +1,159 @@
1
+ // Copyright 2014 Akamai Technologies, Inc. All Rights Reserved
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ const crypto = require('crypto'),
16
+ moment = require('moment'),
17
+ logger = require('./logger'),
18
+ path = require('path'),
19
+ os = require('os');
20
+
21
+ module.exports = {
22
+ createTimestamp: function () {
23
+ return moment().utc().format('YYYYMMDDTHH:mm:ss+0000');
24
+ },
25
+
26
+ contentHash: function (request, maxBody) {
27
+ let contentHash = '',
28
+ preparedBody = request.body || '',
29
+ isTarball = preparedBody instanceof Uint8Array && request.headers['Content-Type'] === 'application/gzip';
30
+
31
+ if (typeof preparedBody === 'object' && !isTarball) {
32
+ let postDataNew = '',
33
+ key;
34
+
35
+ logger.info('Body content is type Object, transforming to POST data');
36
+
37
+ for (key in preparedBody) {
38
+ postDataNew += key + '=' + encodeURIComponent(JSON.stringify(preparedBody[key])) + '&';
39
+ }
40
+
41
+ // Strip trailing ampersand
42
+ postDataNew = postDataNew.replace(/&+$/, "");
43
+
44
+ preparedBody = postDataNew;
45
+ request.body = preparedBody; // Is this required or being used?
46
+ }
47
+
48
+ logger.info('Body is \"' + preparedBody + '\"');
49
+ logger.debug('PREPARED BODY LENGTH', preparedBody.length);
50
+
51
+ if (request.method === 'POST' && preparedBody.length > 0) {
52
+
53
+ logger.info('Signing content: \"' + preparedBody + '\"');
54
+
55
+ // If body data is too large, cut down to max-body size
56
+ if (preparedBody.length > maxBody) {
57
+ logger.warn('Data length (' + preparedBody.length + ') is larger than maximum ' + maxBody);
58
+ if (isTarball)
59
+ preparedBody = preparedBody.slice(0, maxBody);
60
+ else
61
+ preparedBody = preparedBody.substring(0, maxBody);
62
+ logger.info('Body truncated. New value \"' + preparedBody + '\"');
63
+ }
64
+
65
+ logger.debug('PREPARED BODY', preparedBody);
66
+
67
+ contentHash = this.base64Sha256(preparedBody);
68
+ logger.info('Content hash is \"' + contentHash + '\"');
69
+ }
70
+
71
+ return contentHash;
72
+ },
73
+
74
+ dataToSign: function (request, authHeader, maxBody) {
75
+ const parsedUrl = new URL(request.url),
76
+ dataToSign = [
77
+ request.method.toUpperCase(),
78
+ parsedUrl.protocol.replace(":", ""),
79
+ parsedUrl.host,
80
+ parsedUrl.pathname + parsedUrl.search,
81
+ this.canonicalizeHeaders(request.headersToSign),
82
+ this.contentHash(request, maxBody),
83
+ authHeader
84
+ ];
85
+
86
+ const dataToSignStr = dataToSign.join('\t').toString();
87
+
88
+ logger.info('Data to sign: "' + dataToSignStr + '" \n');
89
+
90
+ return dataToSignStr;
91
+ },
92
+
93
+ extend: function (a, b) {
94
+ let key;
95
+
96
+ for (key in b) {
97
+ if (!a.hasOwnProperty(key)) {
98
+ a[key] = b[key];
99
+ }
100
+ }
101
+
102
+ return a;
103
+ },
104
+
105
+ isRedirect: function (statusCode) {
106
+ return [
107
+ 300, 301, 302, 303, 307
108
+ ].indexOf(statusCode) !== -1;
109
+ },
110
+
111
+ base64Sha256: function (data) {
112
+ const shasum = crypto.createHash('sha256').update(data);
113
+
114
+ return shasum.digest('base64');
115
+ },
116
+
117
+ base64HmacSha256: function (data, key) {
118
+ const encrypt = crypto.createHmac('sha256', key);
119
+
120
+ encrypt.update(data);
121
+
122
+ return encrypt.digest('base64');
123
+ },
124
+
125
+ /**
126
+ * Creates a String containing a tab delimited set of headers.
127
+ * @param {Object} headers Object containing the headers to add to the set.
128
+ * @return {String} String containing a tab delimited set of headers.
129
+ */
130
+ canonicalizeHeaders: function (headers) {
131
+ const formattedHeaders = [];
132
+ let key;
133
+
134
+ for (key in headers) {
135
+ formattedHeaders.push(key.toLowerCase() + ':' + headers[key].trim().replace(/\s+/g, ' '));
136
+ }
137
+
138
+ return formattedHeaders.join('\t');
139
+ },
140
+
141
+ signingKey: function (timestamp, clientSecret) {
142
+ const key = this.base64HmacSha256(timestamp, clientSecret);
143
+
144
+ logger.info('Signing key: ' + key + '\n');
145
+
146
+ return key;
147
+ },
148
+
149
+ signRequest: function (request, timestamp, clientSecret, authHeader, maxBody) {
150
+ return this.base64HmacSha256(this.dataToSign(request, authHeader, maxBody), this.signingKey(timestamp, clientSecret));
151
+ },
152
+
153
+ resolveHome: function (filePath) {
154
+ if (filePath[0] === '~') {
155
+ return path.join(os.homedir(), filePath.slice(1));
156
+ }
157
+ return filePath;
158
+ },
159
+ };
package/src/logger.js ADDED
@@ -0,0 +1,26 @@
1
+ // Copyright 2014 Akamai Technologies, Inc. All Rights Reserved
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ const log4js = require('log4js'),
16
+ logger = log4js.getLogger();
17
+
18
+ if (!process.env.LOG4JS_CONFIG) {
19
+ logger.setLevel(log4js.levels.ERROR);
20
+ }
21
+
22
+ if (process.env.EDGEGRID_ENV === 'test') {
23
+ logger.level = log4js.levels.OFF;
24
+ }
25
+
26
+ module.exports = logger;
@@ -0,0 +1,324 @@
1
+ // Copyright 2014 Akamai Technologies, Inc. All Rights Reserved
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ const assert = require('assert'),
16
+ nock = require('nock'),
17
+ path = require('path'),
18
+ Api = require('../../src/api');
19
+
20
+ describe('Api', function () {
21
+ beforeEach(function () {
22
+ this.api = new Api(
23
+ 'clientToken',
24
+ 'clientSecret',
25
+ 'accessToken',
26
+ 'base.com'
27
+ );
28
+ });
29
+
30
+ // clear env variables which might be set in tests
31
+ beforeEach(function () {
32
+ process.env['AKAMAI_HOST'] = '';
33
+ process.env['AKAMAI_CLIENT_TOKEN'] = '';
34
+ process.env['AKAMAI_CLIENT_SECRET'] = '';
35
+ process.env['AKAMAI_ACCESS_TOKEN'] = '';
36
+ });
37
+
38
+ describe('.config', function () {
39
+ it('reports the client token', function () {
40
+ assert.strictEqual(this.api.config.client_token, 'clientToken');
41
+ });
42
+
43
+ it('reports the client secret', function () {
44
+ assert.strictEqual(this.api.config.client_secret, 'clientSecret');
45
+ });
46
+
47
+ it('reports the access token', function () {
48
+ assert.strictEqual(this.api.config.access_token, 'accessToken');
49
+ });
50
+
51
+ it('reports the API host', function () {
52
+ assert.strictEqual(this.api.config.host, 'https://base.com');
53
+ });
54
+
55
+ describe('when it is instantiated with an API host that already contains the protocol', function () {
56
+ it('it does not double declare the protocol', function () {
57
+ this.api = new Api(
58
+ 'clientToken',
59
+ 'clientSecret',
60
+ 'accessToken',
61
+ 'https://base.com'
62
+ );
63
+
64
+ assert.strictEqual(this.api.config.host, 'https://base.com');
65
+ });
66
+ });
67
+
68
+ describe('when it is instantiated with an object', function () {
69
+ beforeEach(function () {
70
+ this.api = new Api({
71
+ path: path.resolve(__dirname, '../test_edgerc'),
72
+ section: 'section'
73
+ });
74
+ });
75
+
76
+ it('reports the client token from the edgerc associated with the specified section', function () {
77
+ assert.strictEqual(this.api.config.client_token, 'sectionClientToken');
78
+ });
79
+
80
+ it('reports the client secret from the edgerc associated with the specified section', function () {
81
+ assert.strictEqual(this.api.config.client_secret, 'sectionClientSecret');
82
+ });
83
+
84
+ it('reports the access token from the edgerc associated with the specified section', function () {
85
+ assert.strictEqual(this.api.config.access_token, 'sectionAccessToken');
86
+ });
87
+
88
+ it('reports the API host from the edgerc associated with the specified section', function () {
89
+ assert.strictEqual(this.api.config.host, 'https://sectionexample.luna.akamaiapis.net');
90
+ });
91
+
92
+ describe('when it is instantiated with an object that does not specfy a section', function () {
93
+ beforeEach(function () {
94
+ this.api = new Api({
95
+ path: path.resolve(__dirname, '../test_edgerc')
96
+ });
97
+ });
98
+
99
+ it('reports the client token from the edgerc associated with the default section', function () {
100
+ assert.strictEqual(this.api.config.client_token, 'clientToken');
101
+ });
102
+
103
+ it('reports the client secret from the edgerc associated with the default section', function () {
104
+ assert.strictEqual(this.api.config.client_secret, 'clientSecret');
105
+ });
106
+
107
+ it('reports the access token from the edgerc associated with the default section', function () {
108
+ assert.strictEqual(this.api.config.access_token, 'accessToken');
109
+ });
110
+
111
+ it('reports the API host from the edgerc associated with the default section', function () {
112
+ assert.strictEqual(this.api.config.host, 'https://example.luna.akamaiapis.net');
113
+ });
114
+ });
115
+
116
+ describe('when it is instantiated with an object that does not specify a path nor a section', function () {
117
+ beforeEach(function () {
118
+ process.env['AKAMAI_HOST'] = 'https://example.luna.akamaiapis.net';
119
+ process.env['AKAMAI_CLIENT_TOKEN'] = 'clientToken';
120
+ process.env['AKAMAI_CLIENT_SECRET'] = 'clientSecret';
121
+ process.env['AKAMAI_ACCESS_TOKEN'] = 'accessToken';
122
+ this.api = new Api({});
123
+ });
124
+ it('uses config from env variables with default section', function () {
125
+ assert.strictEqual(this.api.config.host, "https://example.luna.akamaiapis.net");
126
+ assert.strictEqual(this.api.config.client_token, "clientToken");
127
+ assert.strictEqual(this.api.config.client_secret, "clientSecret");
128
+ assert.strictEqual(this.api.config.access_token, "accessToken");
129
+ });
130
+ });
131
+
132
+ describe('when it is instantiated with an object that specifies an inadequate path', function () {
133
+ it('throws the appropriate error', function () {
134
+ assert.throws(
135
+ function () {
136
+ return new Api({
137
+ path: ''
138
+ });
139
+ },
140
+ /Either path to '.edgerc' or environment variables with edgerc configuration has to be provided./
141
+ );
142
+ });
143
+ });
144
+ });
145
+ });
146
+
147
+ describe('when it is not instantiated with valid credentials', function () {
148
+ it('throws the appropriate error', function () {
149
+ assert.throws(
150
+ function () {
151
+ return new Api();
152
+ },
153
+ /Insufficient Akamai credentials/
154
+ );
155
+ });
156
+ });
157
+
158
+ describe('#auth', function () {
159
+ it('should be chainable', function () {
160
+ assert.deepStrictEqual(this.api, this.api.auth({path: '/foo'}));
161
+ });
162
+
163
+ describe('when minimal request options are passed', function () {
164
+ beforeEach(function () {
165
+ this.api.auth({
166
+ path: '/foo'
167
+ });
168
+ });
169
+
170
+ it('adds an Authorization header to the request it is passed', function () {
171
+ assert.strictEqual(typeof this.api.request.headers.Authorization === 'string', true);
172
+ });
173
+
174
+ it('ensures a default Content-Type of application/json', function () {
175
+ assert.strictEqual(this.api.request.headers['Content-Type'], 'application/json');
176
+ });
177
+
178
+ it('ensures a default GET method', function () {
179
+ assert.strictEqual(this.api.request.method, 'GET');
180
+ });
181
+
182
+ it('ensures a default empty body', function () {
183
+ assert.strictEqual(this.api.request.body, '');
184
+ });
185
+
186
+ it('ensures a url is properly declared', function () {
187
+ assert.strictEqual(this.api.request.url, 'https://base.com/foo');
188
+ });
189
+ });
190
+
191
+ describe('when more specific request options are passed', function () {
192
+ beforeEach(function () {
193
+ this.api.auth({
194
+ path: '/foo',
195
+ method: 'POST',
196
+ body: {
197
+ foo: 'bar'
198
+ },
199
+ somethingArbitrary: 'someValue'
200
+ });
201
+ });
202
+
203
+ it('adds an Authorization header to the request it is passed', function () {
204
+ assert.strictEqual(typeof this.api.request.headers.Authorization === 'string', true);
205
+ });
206
+
207
+ it('ensures a default Content-Type of application/json', function () {
208
+ assert.strictEqual(this.api.request.headers['Content-Type'], 'application/json');
209
+ });
210
+
211
+ it('uses the specified POST method', function () {
212
+ assert.strictEqual(this.api.request.method, 'POST');
213
+ });
214
+
215
+ it('uses the specified body parsed as a JSON string', function () {
216
+ console.log("BODY: ", this.api.request.body);
217
+ assert.strictEqual(this.api.request.body, '{"foo":"bar"}');
218
+ });
219
+
220
+ it('extends the default request options with any others specified', function () {
221
+ assert.strictEqual(this.api.request.somethingArbitrary, 'someValue');
222
+ });
223
+ });
224
+ });
225
+
226
+ describe('#send', function () {
227
+
228
+ it('should be chainable', function () {
229
+ assert.deepStrictEqual(this.api, this.api.auth({path: '/foo'}).send());
230
+ });
231
+
232
+ describe('when authentication is done with a simple options object specifying only a path', function () {
233
+ beforeEach(function () {
234
+ nock('https://base.com')
235
+ .get('/foo')
236
+ .reply(200, {
237
+ foo: 'bar'
238
+ });
239
+ });
240
+
241
+ it('sends the HTTP GET request created by #auth', function (done) {
242
+ this.api.auth({
243
+ path: '/foo'
244
+ });
245
+
246
+ this.api.send(function (err, resp, body) {
247
+ assert.strictEqual(JSON.parse(body).foo, 'bar');
248
+ done();
249
+ });
250
+ });
251
+ });
252
+
253
+ describe('when authentication is done with a more complex options object specifying only a path', function () {
254
+ beforeEach(function () {
255
+ nock('https://base.com')
256
+ .post('/foo')
257
+ .reply(200, {
258
+ foo: 'bar'
259
+ });
260
+ });
261
+
262
+ it('sends the HTTP created by #auth', function (done) {
263
+ this.api.auth({
264
+ path: '/foo',
265
+ method: 'POST'
266
+ });
267
+
268
+ this.api.send(function (err, resp, body) {
269
+ assert.strictEqual(JSON.parse(body).foo, 'bar');
270
+ done();
271
+ });
272
+ });
273
+ });
274
+
275
+ describe('when the initial request redirects', function () {
276
+ it('correctly follows the redirect and re-signs the request', function (done) {
277
+ let authHeader;
278
+ nock('https://base.com')
279
+ .get('/foo')
280
+ .reply(function () {
281
+ authHeader = this.req.headers["authorization"];
282
+ return [
283
+ 302,
284
+ '',
285
+ {'location': 'https://base.com/bar'}
286
+ ];
287
+ })
288
+ .get('/bar')
289
+ .reply(function () {
290
+ assert.notStrictEqual(this.req.headers["authorization"], authHeader);
291
+ return [
292
+ 200,
293
+ {someKey: 'value'}
294
+ ];
295
+ });
296
+
297
+ this.api.auth({
298
+ path: '/foo',
299
+ });
300
+
301
+ this.api.send(function (err, resp, body) {
302
+ assert.strictEqual(JSON.parse(body).someKey, 'value');
303
+ done();
304
+ });
305
+ });
306
+ });
307
+ describe('when the initial request fails', function () {
308
+ it('correctly handles the error in the callback', function (done) {
309
+ nock('https://base.com')
310
+ .get('/foo')
311
+ .replyWithError('something awful happened');
312
+
313
+ this.api.auth({
314
+ path: '/foo',
315
+ });
316
+
317
+ this.api.send(function (data) {
318
+ assert.strictEqual(data.message, 'something awful happened');
319
+ done();
320
+ });
321
+ });
322
+ });
323
+ });
324
+ });
@@ -0,0 +1,154 @@
1
+ // Copyright 2014 Akamai Technologies, Inc. All Rights Reserved
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ const assert = require('assert'),
16
+ path = require('path'),
17
+ edgerc = require('../../src/edgerc');
18
+
19
+ describe('edgerc', function () {
20
+ beforeEach(function () {
21
+ process.env['AKAMAI_HOST'] = '';
22
+ process.env['AKAMAI_CLIENT_TOKEN'] = '';
23
+ process.env['AKAMAI_CLIENT_SECRET'] = '';
24
+ process.env['AKAMAI_ACCESS_TOKEN'] = '';
25
+ });
26
+ describe('the parsed edgrc file it returns', function () {
27
+ describe('when it is not passed a second argument indicating config section', function () {
28
+ beforeEach(function () {
29
+ this.config = edgerc(path.resolve(__dirname, '../test_edgerc'));
30
+ });
31
+
32
+ it('reports the default host', function () {
33
+ assert.strictEqual(this.config.host, 'https://example.luna.akamaiapis.net');
34
+ });
35
+
36
+ it('reports the default client_token', function () {
37
+ assert.strictEqual(this.config.client_token, 'clientToken');
38
+ });
39
+
40
+ it('reports the default client_secret', function () {
41
+ assert.strictEqual(this.config.client_secret, 'clientSecret');
42
+ });
43
+
44
+ it('reports the default access_token', function () {
45
+ assert.strictEqual(this.config.access_token, 'accessToken');
46
+ });
47
+ });
48
+
49
+ describe('when it is passed a second argument indicating config section', function () {
50
+ beforeEach(function () {
51
+ this.config = edgerc(path.resolve(__dirname, '../test_edgerc'), 'section');
52
+ });
53
+
54
+ it('reports the host associated with the section', function () {
55
+ assert.strictEqual(this.config.host, 'https://sectionexample.luna.akamaiapis.net');
56
+ });
57
+
58
+ it('reports the client_token associated with the section', function () {
59
+ assert.strictEqual(this.config.client_token, 'sectionClientToken');
60
+ });
61
+
62
+ it('reports the client_secret associated with the section', function () {
63
+ assert.strictEqual(this.config.client_secret, 'sectionClientSecret');
64
+ });
65
+
66
+ it('reports the access_token associated with the section', function () {
67
+ assert.strictEqual(this.config.access_token, 'sectionAccessToken');
68
+ });
69
+ });
70
+
71
+ describe('when the section contains a host with the "https://" protocal specified', function () {
72
+ beforeEach(function () {
73
+ this.config = edgerc(path.resolve(__dirname, '../test_edgerc'), 'https');
74
+ });
75
+
76
+ it('reports a host with a valid URI string', function () {
77
+ assert.strictEqual(this.config.host, 'https://example.luna.akamaiapis.net');
78
+ });
79
+ });
80
+
81
+ describe('when the section passed does not exist', function () {
82
+ it('throws the proper error', function () {
83
+ assert.throws(
84
+ function () {
85
+ return edgerc(path.resolve(__dirname, '../test_edgerc'), 'blah');
86
+ },
87
+ /An error occurred parsing the .edgerc file. You probably specified an invalid section name./
88
+ );
89
+ });
90
+ });
91
+
92
+ describe('when the section has comments', function () {
93
+ beforeEach(function () {
94
+ this.config = edgerc(path.resolve(__dirname, '../test_edgerc'), 'comment-test');
95
+ });
96
+
97
+ it('has six configuration items', function () {
98
+ assert.strictEqual(Object.keys(this.config).length, 6);
99
+ });
100
+
101
+ it('parses a value with a semicolon properly', function () {
102
+ assert.strictEqual(this.config.client_secret, "client;secret");
103
+ });
104
+
105
+ it('parses a complex value properly', function () {
106
+ assert.strictEqual(this.config.other, 'The "most" \\\'interesting\\\' ; value in the \\";world\\"');
107
+ });
108
+ });
109
+
110
+ describe('when the envs are used with default section', function () {
111
+ beforeEach(function () {
112
+ process.env['AKAMAI_HOST'] = 'https://example.luna.akamaiapis.net';
113
+ process.env['AKAMAI_CLIENT_TOKEN'] = 'clientToken';
114
+ process.env['AKAMAI_CLIENT_SECRET'] = 'clientSecret';
115
+ process.env['AKAMAI_ACCESS_TOKEN'] = 'accessToken';
116
+ this.config = edgerc();
117
+ });
118
+
119
+ it('has four configuration items', function () {
120
+ assert.strictEqual(Object.keys(this.config).length, 4);
121
+ });
122
+
123
+ it('has valid config values', function () {
124
+ assert.strictEqual(this.config.host, "https://example.luna.akamaiapis.net");
125
+ assert.strictEqual(this.config.client_token, "clientToken");
126
+ assert.strictEqual(this.config.client_secret, "clientSecret");
127
+ assert.strictEqual(this.config.access_token, "accessToken");
128
+ });
129
+ });
130
+
131
+ describe('when the envs are used with custom section', function () {
132
+ beforeEach(function () {
133
+ process.env['AKAMAI_SOME_SECTION_HOST'] = 'https://example.luna.akamaiapis.net';
134
+ process.env['AKAMAI_SOME_SECTION_CLIENT_TOKEN'] = 'clientToken';
135
+ process.env['AKAMAI_SOME_SECTION_CLIENT_SECRET'] = 'clientSecret';
136
+ process.env['AKAMAI_SOME_SECTION_ACCESS_TOKEN'] = 'accessToken';
137
+ this.config = edgerc(undefined, 'some_section');
138
+ });
139
+ afterEach(function () {
140
+ process.env['AKAMAI_SOME_SECTION_HOST'] = '';
141
+ process.env['AKAMAI_SOME_SECTION_CLIENT_TOKEN'] = '';
142
+ process.env['AKAMAI_SOME_SECTION_CLIENT_SECRET'] = '';
143
+ process.env['AKAMAI_SOME_SECTION_ACCESS_TOKEN'] = '';
144
+ });
145
+
146
+ it('has valid config values', function () {
147
+ assert.strictEqual(this.config.host, "https://example.luna.akamaiapis.net");
148
+ assert.strictEqual(this.config.client_token, "clientToken");
149
+ assert.strictEqual(this.config.client_secret, "clientSecret");
150
+ assert.strictEqual(this.config.access_token, "accessToken");
151
+ });
152
+ });
153
+ });
154
+ });