2013-11-08 10:22:08 +04:00
|
|
|
|
//
|
|
|
|
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
//
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
//
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
var assert = require('assert');
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-04-16 09:40:23 +04:00
|
|
|
|
// Test includes
|
|
|
|
|
var testutil = require('./util/util');
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-04-16 09:40:23 +04:00
|
|
|
|
// Lib includes
|
|
|
|
|
var azure = testutil.libRequire('azure');
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var storage = testutil.libRequire('services/legacyStorage');
|
2014-07-15 04:11:20 +04:00
|
|
|
|
var ServiceBusServiceClient = testutil.libRequire('services/serviceBus/lib/servicebusserviceclient');
|
2013-06-19 00:58:15 +04:00
|
|
|
|
var ServiceClientConstants = azure.ServiceClientConstants;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
var environmentAzureStorageAccount = 'myaccount';
|
2012-10-13 00:50:18 +04:00
|
|
|
|
var environmentAzureStorageAccessKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
|
2013-04-20 01:57:32 +04:00
|
|
|
|
var environmentAzureStorageDnsSuffix = 'core.windows.net';
|
2012-02-09 05:21:16 +04:00
|
|
|
|
var environmentServiceBusNamespace = 'mynamespace';
|
|
|
|
|
var environmentServiceBusIssuer = 'myissuer';
|
2012-10-13 00:50:18 +04:00
|
|
|
|
var environmentServiceBusAccessKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
|
2012-02-09 05:21:16 +04:00
|
|
|
|
var environmentWrapNamespace = 'mynamespace-sb';
|
|
|
|
|
|
2011-12-10 03:47:08 +04:00
|
|
|
|
var parameterAzureStorageAccount = 'storageAccount';
|
2012-10-13 02:53:02 +04:00
|
|
|
|
var parameterAzureStorageAccessKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
var firstRun = true;
|
|
|
|
|
var originalAzureStorageAccount = null;
|
|
|
|
|
var originalAzureStorageAccessKey = null;
|
2013-04-20 01:57:32 +04:00
|
|
|
|
var originalAzureStorageDnsSuffix = null;
|
2012-02-09 05:21:16 +04:00
|
|
|
|
var originalServiceBusNamespace = null;
|
|
|
|
|
var originalServiceBusIssuer = null;
|
2012-02-14 06:53:57 +04:00
|
|
|
|
var originalServiceBusAccessKey = null;
|
2012-02-09 05:21:16 +04:00
|
|
|
|
var originalWrapNamespace = null;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
suite('azure', function () {
|
|
|
|
|
setup(function (done) {
|
2011-12-10 03:47:08 +04:00
|
|
|
|
if (firstRun) {
|
|
|
|
|
firstRun = false;
|
|
|
|
|
|
|
|
|
|
// On the first run store the previous azure storage account / azure storage access key from the environment
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalAzureStorageAccount && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT]) {
|
|
|
|
|
originalAzureStorageAccount = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT];
|
2011-12-10 03:47:08 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalAzureStorageAccessKey && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY]) {
|
|
|
|
|
originalAzureStorageAccessKey = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY];
|
2011-12-10 03:47:08 +04:00
|
|
|
|
}
|
2012-02-09 05:21:16 +04:00
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalAzureStorageDnsSuffix && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX]) {
|
|
|
|
|
originalAzureStorageDnsSuffix = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX];
|
2013-04-20 01:57:32 +04:00
|
|
|
|
}
|
2012-02-09 05:21:16 +04:00
|
|
|
|
// On the first run store the previous azure storage account / azure storage access key from the environment
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalServiceBusNamespace && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE]) {
|
|
|
|
|
originalServiceBusNamespace = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE];
|
2012-02-09 05:21:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalServiceBusIssuer && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER]) {
|
|
|
|
|
originalServiceBusIssuer = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER];
|
2012-02-09 05:21:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalServiceBusAccessKey && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY]) {
|
|
|
|
|
originalServiceBusAccessKey = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY];
|
2012-02-09 05:21:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
if (!originalWrapNamespace && process.env[ServiceClientConstants.EnvironmentVariables.AZURE_WRAP_NAMESPACE]) {
|
|
|
|
|
originalWrapNamespace = process.env[ServiceClientConstants.EnvironmentVariables.AZURE_WRAP_NAMESPACE];
|
2012-02-09 05:21:16 +04:00
|
|
|
|
}
|
2011-12-10 03:47:08 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
teardown(function (done) {
|
2011-12-10 03:47:08 +04:00
|
|
|
|
// Make sure emulated is never a left over after the test runs.
|
2013-06-19 00:58:15 +04:00
|
|
|
|
delete process.env[ServiceClientConstants.EnvironmentVariables.EMULATED];
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
if (originalAzureStorageAccount) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT] = originalAzureStorageAccount;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (originalAzureStorageAccessKey) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY] = originalAzureStorageAccessKey;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-14 06:53:57 +04:00
|
|
|
|
if (originalServiceBusNamespace) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] = originalServiceBusNamespace;
|
2012-02-14 06:53:57 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (originalServiceBusIssuer) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER] = originalServiceBusIssuer;
|
2012-02-14 06:53:57 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (originalServiceBusAccessKey) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY] = originalServiceBusAccessKey;
|
2012-02-14 06:53:57 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (originalWrapNamespace) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_WRAP_NAMESPACE] = originalWrapNamespace;
|
2012-02-14 06:53:57 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-10 03:47:08 +04:00
|
|
|
|
// clean up
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2012-10-13 03:42:42 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
test('ExponentialRetryPolicyFilter', function (done) {
|
|
|
|
|
assert.notEqual(azure.ExponentialRetryPolicyFilter, null);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
test('LinearRetryPolicyFilter', function (done) {
|
|
|
|
|
assert.notEqual(azure.LinearRetryPolicyFilter, null);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Constants', function (done) {
|
|
|
|
|
assert.notEqual(azure.Constants, null);
|
|
|
|
|
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('IsEmulated', function (done) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
var ServiceClientConstants = azure.ServiceClientConstants;
|
|
|
|
|
delete process.env[ServiceClientConstants.EnvironmentVariables.EMULATED];
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(azure.isEmulated(), false);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2014-07-25 01:29:08 +04:00
|
|
|
|
// set some environment credentials for the live microsoft azure services
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT] = environmentAzureStorageAccount;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY] = environmentAzureStorageAccessKey;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX] = environmentAzureStorageDnsSuffix;
|
2013-05-10 21:13:50 +04:00
|
|
|
|
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var blobService1 = storage.createBlobService();
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(blobService1.host, environmentAzureStorageAccount + '.' + ServiceClientConstants.CLOUD_BLOB_HOST);
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService1.usePathStyleUri, false);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.EMULATED] = true;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var blobService2 = storage.createBlobService();
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService2.host, '127.0.0.1');
|
|
|
|
|
assert.equal(blobService2.usePathStyleUri, true);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
test('NotEmulatedExplicitCredentials', function (done) {
|
2011-12-10 03:47:08 +04:00
|
|
|
|
// Make sure is not emulated
|
2013-06-19 00:58:15 +04:00
|
|
|
|
delete process.env[ServiceClientConstants.EnvironmentVariables.EMULATED];
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2014-07-25 01:29:08 +04:00
|
|
|
|
// set some environment credentials for the live microsoft azure services
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT] = environmentAzureStorageAccount;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY] = environmentAzureStorageAccessKey;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX] = environmentAzureStorageDnsSuffix;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Create blob client passing some credentials
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var blobService = storage.createBlobService(parameterAzureStorageAccount, parameterAzureStorageAccessKey);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Points to the live services
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService.usePathStyleUri, false);
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(blobService.host, parameterAzureStorageAccount.toLowerCase() + '.' + ServiceClientConstants.CLOUD_BLOB_HOST);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2013-06-18 03:41:24 +04:00
|
|
|
|
// And credentials are the ones passed
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccount, parameterAzureStorageAccount);
|
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccessKey, parameterAzureStorageAccessKey);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
test('EmulatedExplicitCredentials', function (done) {
|
2011-12-10 03:47:08 +04:00
|
|
|
|
// set emulated to true
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.EMULATED] = true;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2014-07-25 01:29:08 +04:00
|
|
|
|
// set some environment credentials for the live microsoft azure services
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT] = environmentAzureStorageAccount;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY] = environmentAzureStorageAccessKey;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX] = environmentAzureStorageDnsSuffix;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Create blob client passing some credentials
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var blobService = storage.createBlobService(parameterAzureStorageAccount, parameterAzureStorageAccessKey);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-10-13 02:53:02 +04:00
|
|
|
|
// Points to the credentials
|
|
|
|
|
assert.equal(blobService.usePathStyleUri, false);
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(blobService.host + ':' + blobService.port, parameterAzureStorageAccount.toLowerCase() + '.' + ServiceClientConstants.CLOUD_BLOB_HOST + ':443');
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// But the used credentials are the ones passed because we were explicit
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccount, parameterAzureStorageAccount);
|
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccessKey, parameterAzureStorageAccessKey);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2012-10-13 03:42:42 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
test('EmulatedWithoutParameters', function (done) {
|
2011-12-10 03:47:08 +04:00
|
|
|
|
// set emulated to true
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.EMULATED] = true;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2014-07-25 01:29:08 +04:00
|
|
|
|
// set some environment credentials for the live microsoft azure services
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT] = environmentAzureStorageAccount;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY] = environmentAzureStorageAccessKey;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX] = environmentAzureStorageDnsSuffix;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Create blob client without passing any credentials
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var blobService = storage.createBlobService();
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Points to the emulator
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService.usePathStyleUri, true);
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(blobService.host + ':' + blobService.port, ServiceClientConstants.DEVSTORE_BLOB_HOST);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// And uses the emulator credentials
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccount, ServiceClientConstants.DEVSTORE_STORAGE_ACCOUNT);
|
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccessKey, ServiceClientConstants.DEVSTORE_STORAGE_ACCESS_KEY);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
2012-10-13 03:42:42 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
test('NotEmulatedWithoutParameters', function (done) {
|
2011-12-10 03:47:08 +04:00
|
|
|
|
// Make sure is not emulated
|
2013-06-19 00:58:15 +04:00
|
|
|
|
delete process.env[ServiceClientConstants.EnvironmentVariables.EMULATED];
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2014-07-25 01:29:08 +04:00
|
|
|
|
// set some environment credentials for the live microsoft azure services
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCOUNT] = environmentAzureStorageAccount;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY] = environmentAzureStorageAccessKey;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_STORAGE_DNS_SUFFIX] = environmentAzureStorageDnsSuffix;
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Create blob client without passing any credentials
|
2014-10-02 01:44:00 +04:00
|
|
|
|
var blobService = storage.createBlobService();
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// Points to the live service
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService.usePathStyleUri, false);
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(blobService.host, environmentAzureStorageAccount + '.' + ServiceClientConstants.CLOUD_BLOB_HOST);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
|
|
|
|
// and uses the environment variables
|
2012-02-24 10:25:15 +04:00
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccount, environmentAzureStorageAccount);
|
|
|
|
|
assert.equal(blobService.authenticationProvider.storageAccessKey, environmentAzureStorageAccessKey);
|
2011-12-10 03:47:08 +04:00
|
|
|
|
|
2012-10-14 02:43:23 +04:00
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('MissingServiceBusIssuerAndWrapNamespace', function (done) {
|
2013-06-19 00:58:15 +04:00
|
|
|
|
delete process.env[ServiceClientConstants.EnvironmentVariables.AZURE_WRAP_NAMESPACE];
|
|
|
|
|
delete process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ISSUER];
|
2012-10-14 02:43:23 +04:00
|
|
|
|
|
2013-06-19 00:58:15 +04:00
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_NAMESPACE] = environmentServiceBusNamespace;
|
|
|
|
|
process.env[ServiceClientConstants.EnvironmentVariables.AZURE_SERVICEBUS_ACCESS_KEY] = environmentServiceBusAccessKey;
|
2012-10-14 02:43:23 +04:00
|
|
|
|
|
|
|
|
|
// Create service bus client without passing any credentials
|
|
|
|
|
var serviceBusService = azure.createServiceBusService();
|
|
|
|
|
|
|
|
|
|
// set correctly
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(serviceBusService.authenticationProvider.acsHost, 'https://' + environmentServiceBusNamespace + ServiceClientConstants.DEFAULT_WRAP_NAMESPACE_SUFFIX + '.accesscontrol.windows.net:443/WRAPv0.9');
|
2012-10-14 02:43:23 +04:00
|
|
|
|
assert.equal(serviceBusService.authenticationProvider.accessKey, environmentServiceBusAccessKey);
|
|
|
|
|
|
|
|
|
|
// defaulted correctly
|
2013-06-19 00:58:15 +04:00
|
|
|
|
assert.equal(serviceBusService.authenticationProvider.issuer, ServiceClientConstants.DEFAULT_SERVICEBUS_ISSUER);
|
2012-10-14 02:43:23 +04:00
|
|
|
|
|
2012-02-24 10:25:15 +04:00
|
|
|
|
done();
|
2012-10-13 03:42:42 +04:00
|
|
|
|
});
|
2012-02-24 10:25:15 +04:00
|
|
|
|
});
|