Add more arc tests (#11145)

* Add more arc tests

* Update comment
This commit is contained in:
Charles Gagnon
2020-06-30 14:05:27 -07:00
committed by GitHub
parent 41315c6e0a
commit a1f600657a
5 changed files with 255 additions and 19 deletions

View File

@@ -0,0 +1,31 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as should from 'should';
import 'mocha';
import { BasicAuth } from '../../controller/auth';
describe('BasicAuth Method Tests', function () {
it('Options applied correctly', async function (): Promise<void> {
const username = 'MyUsername';
const password = 'MyPassword';
let ignoreSslVerification = true;
const auth = new BasicAuth(username, password);
const requestOptions = {} as any;
// We don't need this to be actual valid options since we're just checking the ones applied
auth.applyToRequest(requestOptions);
await vscode.workspace.getConfiguration('arc').update('ignoreSslVerification', ignoreSslVerification, vscode.ConfigurationTarget.Global);
should(requestOptions.auth).deepEqual({ username: username, password: password });
should(requestOptions.agentOptions).deepEqual({ rejectUnauthorized: !ignoreSslVerification });
ignoreSslVerification = false;
await vscode.workspace.getConfiguration('arc').update('ignoreSslVerification', ignoreSslVerification, vscode.ConfigurationTarget.Global);
auth.applyToRequest(requestOptions);
should(requestOptions.agentOptions).deepEqual({ rejectUnauthorized: !ignoreSslVerification });
});
});