@@ -23,12 +23,10 @@ import path = require('path');
2323
2424import * as _ from 'lodash' ;
2525import * as chai from 'chai' ;
26- //import * as nock from 'nock';
2726import * as sinon from 'sinon' ;
2827import * as sinonChai from 'sinon-chai' ;
2928import * as chaiAsPromised from 'chai-as-promised' ;
3029
31- //import * as utils from '../utils';
3230import * as mocks from '../../resources/mocks' ;
3331
3432import {
@@ -38,8 +36,6 @@ import {
3836 RefreshTokenCredential , ServiceAccountCredential ,
3937 getApplicationDefault , isApplicationDefault , ImpersonatedServiceAccountCredential , ApplicationDefaultCredential
4038} from '../../../src/app/credential-internal' ;
41- //import { HttpClient } from '../../../src/utils/api-request';
42- //import { Agent } from 'https';
4339import { deepCopy } from '../../../src/utils/deep-copy' ;
4440
4541chai . should ( ) ;
@@ -53,12 +49,6 @@ if (!process.env.HOME) {
5349 throw new Error ( '$HOME environment variable must be set to run the tests.' ) ;
5450}
5551const GCLOUD_CREDENTIAL_PATH = path . resolve ( process . env . HOME ! , '.config' , GCLOUD_CREDENTIAL_SUFFIX ) ;
56- // const MOCK_REFRESH_TOKEN_CONFIG = {
57- // client_id: 'test_client_id',
58- // client_secret: 'test_client_secret',
59- // type: 'authorized_user',
60- // refresh_token: 'test_token',
61- // };
6252const MOCK_IMPERSONATED_TOKEN_CONFIG = {
6353 delegates : [ ] ,
6454 service_account_impersonation_url : '' ,
@@ -71,37 +61,16 @@ const MOCK_IMPERSONATED_TOKEN_CONFIG = {
7161 type : 'impersonated_service_account'
7262}
7363
74- //const ONE_HOUR_IN_SECONDS = 60 * 60;
75-
7664describe ( 'Credential' , ( ) => {
7765 let mockCertificateObject : any ;
7866 let oldProcessEnv : NodeJS . ProcessEnv ;
79- //let getTokenScope: nock.Scope;
80- //let mockedRequests: nock.Scope[] = [];
81-
82- // before(() => {
83- // getTokenScope = nock('https://accounts.google.com')
84- // .persist()
85- // .post('/o/oauth2/token')
86- // .reply(200, {
87- // access_token: utils.generateRandomAccessToken(),
88- // token_type: 'Bearer',
89- // expires_in: 3600,
90- // }, {
91- // 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
92- // });
93- // });
94-
95- // after(() => getTokenScope.done());
9667
9768 beforeEach ( ( ) => {
9869 mockCertificateObject = _ . clone ( mocks . certificateObject ) ;
9970 oldProcessEnv = process . env ;
10071 } ) ;
10172
10273 afterEach ( ( ) => {
103- //_.forEach(mockedRequests, (mockedRequest) => mockedRequest.done());
104- //mockedRequests = [];
10574 process . env = oldProcessEnv ;
10675 } ) ;
10776
0 commit comments