Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amarzavery committed Sep 11, 2017
1 parent 47222eb commit 3bf8dd6
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 92 deletions.
5 changes: 5 additions & 0 deletions runtime/ms-rest-azure/Changelog.md
@@ -1,3 +1,8 @@

### 2.3.1
- Fixed endpoint information for Azure environments
- Added typings for authfile and msi auth

### 2.3.0
- Added support to authenticate using service principal from auth file. #2225
- Added support for polling PATCH operation with 201 initial response.
Expand Down
2 changes: 1 addition & 1 deletion runtime/ms-rest-azure/index.d.ts
Expand Up @@ -655,7 +655,7 @@ export function loginWithServicePrincipalSecretWithAuthResponse(clientId: string
export interface AuthFileOptions {
/**
* @prop {string} [filePath] Absolute file path to the auth file. If not provided
* then please set the environment variable AZURE_AUTH_LOCATION.
* then please set the environment variable 'AZURE_AUTH_LOCATION'.
*/
filePath?: string;
/**
Expand Down
2 changes: 1 addition & 1 deletion runtime/ms-rest-azure/package.json
Expand Up @@ -5,7 +5,7 @@
"email": "azsdkteam@microsoft.com",
"url": "https://github.com/Azure/azure-sdk-for-node"
},
"version": "2.3.0",
"version": "2.3.1",
"description": "Client Runtime for Node.js Azure client libraries generated using AutoRest",
"tags": [
"node",
Expand Down
180 changes: 90 additions & 90 deletions runtime/ms-rest-azure/test/azureEnvironmentTests.js
@@ -1,91 +1,91 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

var should = require('should');
var msRestAzure = require('../lib/msRestAzure');

describe('AzureEnvironment', function() {
it('can be properly required', function(done) {
var tempEnv = msRestAzure.AzureEnvironment;
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure Production environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.Azure;
tempEnv.name.should.equal('Azure');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.windows.net/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.windows.net');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.azure.com/');
tempEnv.portalUrl.should.equal('http://go.microsoft.com/fwlink/?LinkId=254433');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure China environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.AzureChina;
tempEnv.name.should.equal('AzureChina');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.chinacloudapi.cn/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.chinacloudapi.cn/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.chinacloudapi.cn');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.chinacloudapi.cn');
tempEnv.portalUrl.should.equal('http://go.microsoft.com/fwlink/?LinkId=301902');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure USGovernment environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.AzureUSGovernment;
tempEnv.name.should.equal('AzureUSGovernment');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.usgovcloudapi.net/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.usgovcloudapi.net');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.usgovcloudapi.net');
tempEnv.portalUrl.should.equal('https://manage.windowsazure.us');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure GermanCloud environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.AzureGermanCloud;
tempEnv.name.should.equal('AzureGermanCloud');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.de/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.cloudapi.de/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.cloudapi.de');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.microsoftazure.de');
tempEnv.portalUrl.should.equal('http://portal.microsoftazure.de/');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should be able to add a new environment', function(done) {
var df = {
name: 'Dogfood',
portalUrl: 'http://go.microsoft.com/fwlink/?LinkId=254433',
managementEndpointUrl: 'https://management.core.windows.net',
resourceManagerEndpointUrl: 'https://management.azure.com/',
activeDirectoryEndpointUrl: 'https://login.microsoftonline.com/',
activeDirectoryResourceId: 'https://management.core.windows.net/'
};
var tempEnv = msRestAzure.AzureEnvironment;
var dfood = tempEnv.add(df);
dfood.name.should.equal('Dogfood');
dfood.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
dfood.activeDirectoryResourceId.should.equal('https://management.core.windows.net/');
dfood.managementEndpointUrl.should.equal('https://management.core.windows.net');
dfood.resourceManagerEndpointUrl.should.equal('https://management.azure.com/');
dfood.portalUrl.should.equal('http://go.microsoft.com/fwlink/?LinkId=254433');
dfood.validateAuthority.should.equal(true);

//Verify that the environment properly got added to the prototype
tempEnv.Dogfood.name.should.equal('Dogfood');
tempEnv.Dogfood.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
tempEnv.Dogfood.activeDirectoryResourceId.should.equal('https://management.core.windows.net/');
tempEnv.Dogfood.managementEndpointUrl.should.equal('https://management.core.windows.net');
tempEnv.Dogfood.resourceManagerEndpointUrl.should.equal('https://management.azure.com/');
tempEnv.Dogfood.portalUrl.should.equal('http://go.microsoft.com/fwlink/?LinkId=254433');
tempEnv.Dogfood.validateAuthority.should.equal(true);
done();
});
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

var should = require('should');
var msRestAzure = require('../lib/msRestAzure');

describe('AzureEnvironment', function() {
it('can be properly required', function(done) {
var tempEnv = msRestAzure.AzureEnvironment;
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure Production environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.Azure;
tempEnv.name.should.equal('Azure');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.windows.net/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.windows.net');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.azure.com/');
tempEnv.portalUrl.should.equal('https://portal.azure.com');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure China environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.AzureChina;
tempEnv.name.should.equal('AzureChina');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.chinacloudapi.cn/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.chinacloudapi.cn/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.chinacloudapi.cn');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.chinacloudapi.cn');
tempEnv.portalUrl.should.equal('https://portal.azure.cn');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure USGovernment environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.AzureUSGovernment;
tempEnv.name.should.equal('AzureUSGovernment');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login-us.microsoftonline.com/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.usgovcloudapi.net/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.usgovcloudapi.net');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.usgovcloudapi.net');
tempEnv.portalUrl.should.equal('https://portal.azure.us');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should show the details of Azure GermanCloud environment correctly', function(done) {
var tempEnv = msRestAzure.AzureEnvironment.AzureGermanCloud;
tempEnv.name.should.equal('AzureGermanCloud');
tempEnv.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.de/');
tempEnv.activeDirectoryResourceId.should.equal('https://management.core.cloudapi.de/');
tempEnv.managementEndpointUrl.should.equal('https://management.core.cloudapi.de');
tempEnv.resourceManagerEndpointUrl.should.equal('https://management.microsoftazure.de');
tempEnv.portalUrl.should.equal('http://portal.microsoftazure.de/');
tempEnv.validateAuthority.should.equal(true);
done();
});

it('should be able to add a new environment', function(done) {
var df = {
name: 'Dogfood',
portalUrl: 'http://go.microsoft.com/fwlink/?LinkId=254433',
managementEndpointUrl: 'https://management.core.windows.net',
resourceManagerEndpointUrl: 'https://management.azure.com/',
activeDirectoryEndpointUrl: 'https://login.microsoftonline.com/',
activeDirectoryResourceId: 'https://management.core.windows.net/'
};
var tempEnv = msRestAzure.AzureEnvironment;
var dfood = tempEnv.add(df);
dfood.name.should.equal('Dogfood');
dfood.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
dfood.activeDirectoryResourceId.should.equal('https://management.core.windows.net/');
dfood.managementEndpointUrl.should.equal('https://management.core.windows.net');
dfood.resourceManagerEndpointUrl.should.equal('https://management.azure.com/');
dfood.portalUrl.should.equal('http://go.microsoft.com/fwlink/?LinkId=254433');
dfood.validateAuthority.should.equal(true);

//Verify that the environment properly got added to the prototype
tempEnv.Dogfood.name.should.equal('Dogfood');
tempEnv.Dogfood.activeDirectoryEndpointUrl.should.equal('https://login.microsoftonline.com/');
tempEnv.Dogfood.activeDirectoryResourceId.should.equal('https://management.core.windows.net/');
tempEnv.Dogfood.managementEndpointUrl.should.equal('https://management.core.windows.net');
tempEnv.Dogfood.resourceManagerEndpointUrl.should.equal('https://management.azure.com/');
tempEnv.Dogfood.portalUrl.should.equal('http://go.microsoft.com/fwlink/?LinkId=254433');
tempEnv.Dogfood.validateAuthority.should.equal(true);
done();
});
});

0 comments on commit 3bf8dd6

Please sign in to comment.