@@ -103,7 +103,7 @@ describe('CryptoSigner', () => {
103
103
const input = Buffer . from ( 'input' ) ;
104
104
const signRequest = {
105
105
method : 'POST' ,
106
- url : 'https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/test-service-account :signBlob' ,
106
+ url : 'https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/foo@project_id.iam.gserviceaccount.com :signBlob' ,
107
107
headers : {
108
108
Authorization : `Bearer ${ mockAccessToken } ` ,
109
109
'X-Goog-Api-Client' : getMetricsHeader ( )
@@ -120,7 +120,7 @@ describe('CryptoSigner', () => {
120
120
const expectedResult = utils . responseFrom ( response ) ;
121
121
stub = sinon . stub ( HttpClient . prototype , 'send' ) . resolves ( expectedResult ) ;
122
122
const requestHandler = new AuthorizedHttpClient ( mockApp ) ;
123
- const signer = new IAMSigner ( requestHandler , 'test-service-account' ) ;
123
+ const signer = new IAMSigner ( requestHandler , mockApp ) ;
124
124
return signer . sign ( input ) . then ( ( signature ) => {
125
125
expect ( signature . toString ( 'base64' ) ) . to . equal ( response . signedBlob ) ;
126
126
expect ( stub ) . to . have . been . calledOnce . and . calledWith ( signRequest ) ;
@@ -136,7 +136,7 @@ describe('CryptoSigner', () => {
136
136
} ) ;
137
137
stub = sinon . stub ( HttpClient . prototype , 'send' ) . rejects ( expectedResult ) ;
138
138
const requestHandler = new AuthorizedHttpClient ( mockApp ) ;
139
- const signer = new IAMSigner ( requestHandler , 'test-service-account' ) ;
139
+ const signer = new IAMSigner ( requestHandler , mockApp ) ;
140
140
return signer . sign ( input ) . catch ( ( err ) => {
141
141
expect ( err ) . to . be . instanceOf ( CryptoSignerError ) ;
142
142
expect ( err . message ) . to . equal ( 'Server responded with status 500.' ) ;
@@ -145,9 +145,9 @@ describe('CryptoSigner', () => {
145
145
} ) ;
146
146
} ) ;
147
147
148
- it ( 'should return the explicitly specified service account' , ( ) => {
149
- const signer = new IAMSigner ( new AuthorizedHttpClient ( mockApp ) , 'test-service-account' ) ;
150
- return signer . getAccountId ( ) . should . eventually . equal ( 'test-service-account ' ) ;
148
+ it ( 'should return the service account from the app ' , ( ) => {
149
+ const signer = new IAMSigner ( new AuthorizedHttpClient ( mockApp ) , mockApp ) ;
150
+ return signer . getAccountId ( ) . should . eventually . equal ( 'foo@project_id.iam.gserviceaccount.com ' ) ;
151
151
} ) ;
152
152
} ) ;
153
153
0 commit comments