@@ -3,6 +3,8 @@ var expect = require('chai').expect
33var ConfigReader = require ( './configReader' )
44
55describe ( 'Config Reader module' , function ( ) {
6+ var testApiToken = 'headers.payload.signature'
7+
68 it ( 'creates a configReader' , function ( ) {
79 var config = { }
810
@@ -15,7 +17,7 @@ describe('Config Reader module', function () {
1517 var configReader = ConfigReader . create ( {
1618 serviceName : 'test' ,
1719 reporter : 'dummy' ,
18- apiKey : 'api-key'
20+ apiKey : testApiToken
1921 } )
2022
2123 var getDefaultConfigStub = this . sandbox . stub ( configReader , '_getDefaultConfig' , function ( ) {
@@ -35,7 +37,7 @@ describe('Config Reader module', function () {
3537 serviceName : 'test' ,
3638 reporter : 'dummy' ,
3739 collectorApiUrl : 'http://c.a.b' ,
38- apiKey : 'api-key'
40+ apiKey : testApiToken
3941 } )
4042
4143 var getFileConfigStub = this . sandbox . stub ( configReader , '_getFileConfig' , function ( ) {
@@ -52,7 +54,7 @@ describe('Config Reader module', function () {
5254 serviceName : 'test' ,
5355 reporter : 'dummy' ,
5456 collectorApiUrl : 'http://c.a.b' ,
55- apiKey : 'api-key'
57+ apiKey : testApiToken
5658 } )
5759
5860 var getEnvVarConfigStub = this . sandbox . stub ( configReader , '_getEnvVarConfig' , function ( ) {
@@ -70,7 +72,7 @@ describe('Config Reader module', function () {
7072 serviceName : 'test' ,
7173 reporter : 'dummy' ,
7274 collectorApiUrl : 'http://c.a.b' ,
73- apiKey : 'api-key'
75+ apiKey : testApiToken
7476 } )
7577
7678 var getSystemConfigStub = this . sandbox . stub ( configReader , '_getSystemConfig' , function ( ) {
@@ -88,7 +90,7 @@ describe('Config Reader module', function () {
8890 serviceName : 'test' ,
8991 reporter : 'dummy' ,
9092 collectorApiUrl : 'http://c.a.b' ,
91- apiKey : 'api-key'
93+ apiKey : testApiToken
9294 } )
9395
9496 this . sandbox . stub ( configReader , '_getEnvVarConfig' ) . returns ( { } )
@@ -107,7 +109,7 @@ describe('Config Reader module', function () {
107109 } )
108110
109111 it ( 'environment variables config should override file config' , function ( ) {
110- var configReader = ConfigReader . create ( { serviceName : 'test' , reporter : 'dummy' , apiKey : 'api-key' } )
112+ var configReader = ConfigReader . create ( { serviceName : 'test' , reporter : 'dummy' , apiKey : testApiToken } )
111113
112114 this . sandbox . stub ( configReader , '_getEnvVarConfig' , function ( ) {
113115 return { test : 'env' }
@@ -123,7 +125,7 @@ describe('Config Reader module', function () {
123125 } )
124126
125127 it ( 'system config should override all env var config' , function ( ) {
126- var configReader = ConfigReader . create ( { serviceName : 'test' , reporter : 'dummy' , apiKey : 'api-key' } )
128+ var configReader = ConfigReader . create ( { serviceName : 'test' , reporter : 'dummy' , apiKey : testApiToken } )
127129
128130 this . sandbox . stub ( configReader , '_getSystemConfig' , function ( ) {
129131 return { test : 'system' }
@@ -145,7 +147,7 @@ describe('Config Reader module', function () {
145147 serviceName : 'test' ,
146148 reporter : 'dummy' ,
147149 test : 'param' ,
148- apiKey : 'api-key'
150+ apiKey : testApiToken
149151 } )
150152
151153 this . sandbox . stub ( configReader , '_getSystemConfig' , function ( ) {
@@ -167,7 +169,7 @@ describe('Config Reader module', function () {
167169 process . env . VCAP_SERVICES = JSON . stringify ( {
168170 trace : [ {
169171 credentials : {
170- TRACE_API_KEY : 'test-key'
172+ TRACE_API_KEY : testApiToken
171173 }
172174 } ]
173175 } )
@@ -180,7 +182,7 @@ describe('Config Reader module', function () {
180182 var cfg = configReader . getConfig ( )
181183
182184 expect ( cfg . serviceName ) . to . eql ( 'test-app' )
183- expect ( cfg . apiKey ) . to . eql ( 'test-key' )
185+ expect ( cfg . apiKey ) . to . eql ( testApiToken )
184186 delete process . env . VCAP_APPLICATION
185187 delete process . env . VCAP_SERVICES
186188 } )
@@ -190,7 +192,7 @@ describe('Config Reader module', function () {
190192 serviceName : 'test' ,
191193 reporter : 'dummy' ,
192194 collectorApiUrl : 'http://c.a.b' ,
193- apiKey : 'api-key'
195+ apiKey : testApiToken
194196 } )
195197
196198 this . sandbox . stub ( configReader , '_getDefaultConfig' , function ( ) {
@@ -209,7 +211,7 @@ describe('Config Reader module', function () {
209211 var configReader = ConfigReader . create ( {
210212 serviceName : 'test' ,
211213 reporter : 'dummy' ,
212- apiKey : 'api-key'
214+ apiKey : testApiToken
213215 } )
214216
215217 this . sandbox . stub ( configReader , '_getEnvVarConfig' , function ( ) {
@@ -229,7 +231,7 @@ describe('Config Reader module', function () {
229231 serviceName : 'test' ,
230232 reporter : 'dummy' ,
231233 configPath : 'param' ,
232- apiKey : 'api-key'
234+ apiKey : testApiToken
233235 } )
234236
235237 var getFileConfigStub = this . sandbox . stub ( configReader , '_getFileConfig' ) . returns ( { } )
@@ -245,7 +247,7 @@ describe('Config Reader module', function () {
245247 serviceName : 'test' ,
246248 reporter : 'dummy' ,
247249 configPath : 'a/surely/nonexisting/path' ,
248- apiKey : 'api-key'
250+ apiKey : testApiToken
249251 } )
250252
251253 configReader . getConfig ( )
@@ -275,7 +277,7 @@ describe('Config Reader module', function () {
275277 serviceName : 'test' ,
276278 reporter : 'dummy' ,
277279 configPath : 'test' ,
278- apiKey : 'api-key'
280+ apiKey : testApiToken
279281 } )
280282 var log = this . sandbox . spy ( console , 'error' )
281283 var wellformed = {
0 commit comments