mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Tenant filter fix (#11411)
* Fix tenant filter * Test for the azure filter feature
This commit is contained in:
@@ -6,10 +6,11 @@
|
||||
import * as should from 'should';
|
||||
import * as os from 'os';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { PromptFailedResult, AccountKey } from 'azdata';
|
||||
import { AzureAuth, AccessToken, RefreshToken, TokenClaims, TokenRefreshResponse } from '../../../account-provider/auths/azureAuth';
|
||||
import { AzureAccount, AzureAuthType, Deferred } from '../../../account-provider/interfaces';
|
||||
import { AzureAccount, AzureAuthType, Deferred, Tenant } from '../../../account-provider/interfaces';
|
||||
import providerSettings from '../../../account-provider/providerSettings';
|
||||
import { SimpleTokenCache } from '../../../account-provider/simpleTokenCache';
|
||||
import { CredentialsTestProvider } from '../../stubs/credentialsTestProvider';
|
||||
@@ -48,6 +49,11 @@ const refreshToken: RefreshToken = {
|
||||
const resourceId = 'resource';
|
||||
const tenantId = 'tenant';
|
||||
|
||||
const tenant: Tenant = {
|
||||
id: tenantId,
|
||||
displayName: 'common'
|
||||
};
|
||||
|
||||
// These tests don't work on Linux systems because gnome-keyring doesn't like running on headless machines.
|
||||
describe('AccountProvider.AzureAuth', function (): void {
|
||||
beforeEach(async function (): Promise<void> {
|
||||
@@ -96,4 +102,16 @@ describe('AccountProvider.AzureAuth', function (): void {
|
||||
should(account.key.accountId).be.equal('someKey');
|
||||
should(account.properties.isMsAccount).be.equal(true);
|
||||
});
|
||||
it('Should handle ignored tenants', async function (): Promise<void> {
|
||||
// Don't sit on the await openConsentDialog if test is failing
|
||||
this.timeout(3000);
|
||||
|
||||
const configuration = vscode.workspace.getConfiguration('azure.tenant.config');
|
||||
const values = [tenantId];
|
||||
|
||||
await configuration.update('filter', values, vscode.ConfigurationTarget.Global);
|
||||
const x = await baseAuth.openConsentDialog(tenant, resourceId);
|
||||
|
||||
should(x).be.false();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user