This commit is contained in:
Andre Rodrigues 2012-10-12 11:21:46 +01:00
Родитель d0f4a8ab43
Коммит b4af3be340
2 изменённых файлов: 103 добавлений и 2 удалений

Просмотреть файл

@ -177,7 +177,7 @@ suite('storageservicesettings-tests', function () {
var expectedTableEndpoint = url.format({ protocol: protocol, host: expectedName + '.' + ConnectionStringKeys.TABLE_BASE_DNS_NAME });
var expectedBlobEndpoint = 'http://myprivateblobdns.com';
var expectedQueueEndpoint = 'http://myprivatequeuedns.com';
var connectionString = 'DefaultEndpointsProtocol=' + protocol + ';AccountName=' + expectedName + ';AccountKey=' + expectedKey + ';QueueEndpoint=' + expectedQueueEndpoint+ ';BlobEndpoint=' + expectedBlobEndpoint;
var connectionString = 'DefaultEndpointsProtocol=' + protocol + ';AccountName=' + expectedName + ';AccountKey=' + expectedKey + ';QueueEndpoint=' + expectedQueueEndpoint + ';BlobEndpoint=' + expectedBlobEndpoint;
// Test
var actual = StorageServiceSettings.createFromConnectionString(connectionString);
@ -225,6 +225,74 @@ suite('storageservicesettings-tests', function () {
}).should.throw('The provided account key ' + invalidKey + ' is not a valid base64 string.');
});
test('testCreateFromConnectionStringWithQueueAndBlobAndTableEndpointSpecfied', function () {
// Setup
var protocol = 'https';
var expectedName = 'mytestaccount';
var expectedKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
var expectedTableEndpoint = 'http://myprivatetabledns.com';
var expectedBlobEndpoint = 'http://myprivateblobdns.com';
var expectedQueueEndpoint = 'http://myprivatequeuedns.com';
var connectionString = 'DefaultEndpointsProtocol=' + protocol + ';AccountName=' + expectedName + ';AccountKey=' + expectedKey + ';QueueEndpoint=' + expectedQueueEndpoint + ';BlobEndpoint=' + expectedBlobEndpoint+ ';TableEndpoint=' + expectedTableEndpoint;
// Test
var actual = StorageServiceSettings.createFromConnectionString(connectionString);
// Assert
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('testCreateFromConnectionStringMissingServicesEndpointsFail', function () {
// Setup
var expectedName = 'mytestaccount';
var expectedKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
var invalidUri = 'https://www.invalid_domain';
var connectionString = 'BlobEndpoint=' + invalidUri + ';DefaultEndpointsProtocol=http;AccountName=' + expectedName + ';AccountKey=' + expectedKey;
// Test
(function() {
StorageServiceSettings.createFromConnectionString(connectionString);
}).should.throw('The provided URI "' + invalidUri + '" is invalid.');
});
test('testCreateFromConnectionStringWithInvalidSettingKeyFail', function () {
// Setup
var expectedName = 'mytestaccount';
var expectedKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
var invalidKey = 'InvalidKey';
var connectionString = 'DefaultEndpointsProtocol=http;' + invalidKey + '=MyValue;AccountName=' + expectedName + ';AccountKey=' + expectedKey;
// Test
(function() {
StorageServiceSettings.createFromConnectionString(connectionString);
}).should.throw('Invalid connection string setting key ' + invalidKey.toLowerCase());
});
test('testCreateFromConnectionStringWithCaseInsensitive', function () {
// Setup
var protocol = 'https';
var expectedName = 'mytestaccount';
var expectedKey = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
var connectionString = 'defaultendpointsprotocol=' + protocol + ';accountname=' + expectedName + ';accountkey=' + expectedKey;
var expectedBlobEndpoint = url.format({ protocol: protocol, host: expectedName + '.' + ConnectionStringKeys.BLOB_BASE_DNS_NAME });
var expectedQueueEndpoint = url.format({ protocol: protocol, host: expectedName + '.' + ConnectionStringKeys.QUEUE_BASE_DNS_NAME });
var expectedTableEndpoint = url.format({ protocol: protocol, host: expectedName + '.' + ConnectionStringKeys.TABLE_BASE_DNS_NAME });
// Test
var actual = StorageServiceSettings.createFromConnectionString(connectionString);
// Assert
actual._name.should.equal(expectedName);
actual._key.should.equal(expectedKey);
actual._blobEndpointUri.should.equal(expectedBlobEndpoint);
actual._queueEndpointUri.should.equal(expectedQueueEndpoint);
actual._tableEndpointUri.should.equal(expectedTableEndpoint);
});
test('getDevelopmentStorageAccount', function () {
var developmentStorageAccount = StorageServiceSettings._getDevelopmentStorageAccount();

Просмотреть файл

@ -1 +1,34 @@
services/core/storageservicesettings-tests.js
cli/commands/generate-psm1-utils-test.js
serviceruntime/roleenvironment-tests.js
serviceruntime/runtimeversionmanager-tests.js
serviceruntime/runtimeversionprotocolclient-tests.js
services/blob/blobservice-tests.js
services/blob/sharedaccesssignature-tests.js
services/blob/sharedkey-tests.js
services/blob/sharedkeylite-tests.js
services/blob/filters-tests.js
services/core/connectionstringparser-tests.js
services/core/serviceclient-tests.js
services/core/exponentialretrypolicyfilter-tests.js
services/core/linearretrypolicyfilter-tests.js
services/core/servicesettings-tests.js
services/core/storageservicesettings-tests.js
services/queue/queueservice-tests.js
services/table/batchserviceclient-tests.js
services/table/sharedkeytable-tests.js
services/table/sharedkeylitetable-tests.js
services/serviceBus/servicebusservice-tests.js
services/serviceBus/wrapservice-tests.js
services/serviceBus/wraptokenmanager-tests.js
services/table/tablequery-tests.js
services/table/tableservice-batch-tests.js
services/table/tableservice-tablequery-tests.js
services/table/tableservice-tests.js
util/atomhandler-tests.js
util/iso8061date-tests.js
util/util-tests.js
util/validate-tests.js
util/certificates/der.decoder-tests.js
util/certificates/der.decoder.pfx.root-tests.js
util/certificates/pkcs.filedecoder-tests.js
azure-tests.js