mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Open in azure portal (#10535)
* initial commit to get it working * Change configuration to use package.nls.json * Make the necessary plumbing * Support multi cloud * Move the menu item to the bottom * Fix failing tests * Fix the tests
This commit is contained in:
@@ -14,6 +14,8 @@ import { ApiWrapper } from '../../../../apiWrapper';
|
||||
import { AzureResourceDatabaseTreeDataProvider } from '../../../../azureResource/providers/database/databaseTreeDataProvider';
|
||||
import { AzureResourceItemType } from '../../../../azureResource/constants';
|
||||
import { IAzureResourceService } from '../../../../azureResource/interfaces';
|
||||
import { AzureAccount } from '../../../../account-provider/interfaces';
|
||||
import settings from '../../../../account-provider/providerSettings';
|
||||
|
||||
// Mock services
|
||||
let mockDatabaseService: TypeMoq.IMock<IAzureResourceService<azureResource.AzureResourceDatabase>>;
|
||||
@@ -21,7 +23,7 @@ let mockApiWrapper: TypeMoq.IMock<ApiWrapper>;
|
||||
let mockExtensionContext: TypeMoq.IMock<vscode.ExtensionContext>;
|
||||
|
||||
// Mock test data
|
||||
const mockAccount: azdata.Account = {
|
||||
const mockAccount: AzureAccount = {
|
||||
key: {
|
||||
accountId: 'mock_account',
|
||||
providerId: 'mock_provider'
|
||||
@@ -32,7 +34,11 @@ const mockAccount: azdata.Account = {
|
||||
contextualDisplayName: 'test',
|
||||
userId: 'test@email.com'
|
||||
},
|
||||
properties: undefined,
|
||||
properties: {
|
||||
providerSettings: settings[0].metadata,
|
||||
isMsAccount: true,
|
||||
tenants: []
|
||||
},
|
||||
isStale: false
|
||||
};
|
||||
|
||||
|
||||
@@ -19,9 +19,11 @@ import { IAzureResourceService } from '../../../../azureResource/interfaces';
|
||||
let mockDatabaseServerService: TypeMoq.IMock<IAzureResourceService<azureResource.AzureResourceDatabaseServer>>;
|
||||
let mockApiWrapper: TypeMoq.IMock<ApiWrapper>;
|
||||
let mockExtensionContext: TypeMoq.IMock<vscode.ExtensionContext>;
|
||||
import settings from '../../../../account-provider/providerSettings';
|
||||
import { AzureAccount } from '../../../../account-provider/interfaces';
|
||||
|
||||
// Mock test data
|
||||
const mockAccount: azdata.Account = {
|
||||
const mockAccount: AzureAccount = {
|
||||
key: {
|
||||
accountId: 'mock_account',
|
||||
providerId: 'mock_provider'
|
||||
@@ -32,7 +34,11 @@ const mockAccount: azdata.Account = {
|
||||
contextualDisplayName: 'test',
|
||||
userId: 'test@email.com'
|
||||
},
|
||||
properties: undefined,
|
||||
properties: {
|
||||
providerSettings: settings[0].metadata,
|
||||
isMsAccount: true,
|
||||
tenants: []
|
||||
},
|
||||
isStale: false
|
||||
};
|
||||
|
||||
|
||||
@@ -5,15 +5,16 @@
|
||||
|
||||
import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as azdata from 'azdata';
|
||||
import 'mocha';
|
||||
import { fail } from 'assert';
|
||||
|
||||
import { azureResource } from '../../azureResource/azure-resource';
|
||||
import { AzureResourceService } from '../../azureResource/resourceService';
|
||||
import { AzureAccount } from '../../account-provider/interfaces';
|
||||
import settings from '../../account-provider/providerSettings';
|
||||
|
||||
// Mock test data
|
||||
const mockAccount: azdata.Account = {
|
||||
const mockAccount: AzureAccount = {
|
||||
key: {
|
||||
accountId: 'mock_account',
|
||||
providerId: 'mock_provider'
|
||||
@@ -24,7 +25,11 @@ const mockAccount: azdata.Account = {
|
||||
contextualDisplayName: 'test',
|
||||
userId: 'test@email.com'
|
||||
},
|
||||
properties: undefined,
|
||||
properties: {
|
||||
providerSettings: settings[0].metadata,
|
||||
isMsAccount: true,
|
||||
tenants: []
|
||||
},
|
||||
isStale: false
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import 'mocha';
|
||||
|
||||
@@ -15,9 +14,11 @@ import { AzureResourceResourceTreeNode } from '../../azureResource/resourceTreeN
|
||||
import { AppContext } from '../../appContext';
|
||||
import { ApiWrapper } from '../../apiWrapper';
|
||||
import { AzureResourceServiceNames } from '../../azureResource/constants';
|
||||
import settings from '../../account-provider/providerSettings';
|
||||
import { AzureAccount } from '../../account-provider/interfaces';
|
||||
|
||||
// Mock test data
|
||||
const mockAccount: azdata.Account = {
|
||||
const mockAccount: AzureAccount = {
|
||||
key: {
|
||||
accountId: 'mock_account',
|
||||
providerId: 'mock_provider'
|
||||
@@ -28,7 +29,11 @@ const mockAccount: azdata.Account = {
|
||||
contextualDisplayName: 'test',
|
||||
userId: 'test@email.com'
|
||||
},
|
||||
properties: undefined,
|
||||
properties: {
|
||||
providerSettings: settings[0].metadata,
|
||||
isMsAccount: true,
|
||||
tenants: []
|
||||
},
|
||||
isStale: false
|
||||
};
|
||||
|
||||
@@ -87,7 +92,7 @@ let mockResourceProvider: TypeMoq.IMock<azureResource.IAzureResourceProvider>;
|
||||
let resourceService: AzureResourceService;
|
||||
let appContext: AppContext;
|
||||
|
||||
describe('AzureResourceResourceTreeNode.info', function(): void {
|
||||
describe('AzureResourceResourceTreeNode.info', function (): void {
|
||||
beforeEach(() => {
|
||||
mockResourceTreeDataProvider = TypeMoq.Mock.ofType<azureResource.IAzureResourceTreeDataProvider>();
|
||||
mockResourceTreeDataProvider.setup((o) => o.getTreeItem(mockResourceRootNode)).returns(() => mockResourceRootNode.treeItem);
|
||||
@@ -105,7 +110,7 @@ describe('AzureResourceResourceTreeNode.info', function(): void {
|
||||
appContext.registerService(AzureResourceServiceNames.resourceService, resourceService);
|
||||
});
|
||||
|
||||
it('Should be correct when created.', async function(): Promise<void> {
|
||||
it('Should be correct when created.', async function (): Promise<void> {
|
||||
const resourceTreeNode = new AzureResourceResourceTreeNode({
|
||||
resourceProviderId: mockResourceProviderId,
|
||||
resourceNode: mockResourceRootNode
|
||||
@@ -127,7 +132,7 @@ describe('AzureResourceResourceTreeNode.info', function(): void {
|
||||
});
|
||||
});
|
||||
|
||||
describe('AzureResourceResourceTreeNode.getChildren', function(): void {
|
||||
describe('AzureResourceResourceTreeNode.getChildren', function (): void {
|
||||
beforeEach(() => {
|
||||
mockResourceTreeDataProvider = TypeMoq.Mock.ofType<azureResource.IAzureResourceTreeDataProvider>();
|
||||
mockResourceTreeDataProvider.setup((o) => o.getChildren(mockResourceRootNode)).returns(() => Promise.resolve(mockResourceNodes));
|
||||
@@ -145,12 +150,12 @@ describe('AzureResourceResourceTreeNode.getChildren', function(): void {
|
||||
appContext.registerService(AzureResourceServiceNames.resourceService, resourceService);
|
||||
});
|
||||
|
||||
it('Should return resource nodes when it is container node.', async function(): Promise<void> {
|
||||
it('Should return resource nodes when it is container node.', async function (): Promise<void> {
|
||||
const resourceTreeNode = new AzureResourceResourceTreeNode({
|
||||
resourceProviderId: mockResourceProviderId,
|
||||
resourceNode: mockResourceRootNode
|
||||
},
|
||||
undefined, appContext);
|
||||
undefined, appContext);
|
||||
|
||||
const children = await resourceTreeNode.getChildren();
|
||||
|
||||
@@ -176,7 +181,7 @@ describe('AzureResourceResourceTreeNode.getChildren', function(): void {
|
||||
}
|
||||
});
|
||||
|
||||
it('Should return empty when it is leaf node.', async function(): Promise<void> {
|
||||
it('Should return empty when it is leaf node.', async function (): Promise<void> {
|
||||
const resourceTreeNode = new AzureResourceResourceTreeNode({
|
||||
resourceProviderId: mockResourceProviderId,
|
||||
resourceNode: mockResourceNode1
|
||||
|
||||
Reference in New Issue
Block a user