Refactred test cases for browsers - drop key based cases from browser testing scope

This commit is contained in:
Xiaoning Liu 2019-08-14 11:54:43 +08:00 коммит произвёл Vincent Jiang (LEI)
Родитель d3808608c3
Коммит d5c93fe1e5
30 изменённых файлов: 9212 добавлений и 20651 удалений

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

@ -30,7 +30,7 @@ if (testUtil.isBrowser()) {
describe('BlobServiceUpload', function () {
before(function (done) {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']);
blobService = testUtil.getBlobService(azure);
assert.notEqual(null, blobService, 'blobService should not be null');
containerName = suite.getName(containerNamesPrefix);

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

@ -39,20 +39,13 @@ var bs = browserify([
path.resolve(__dirname, '../../test/services/file/fileservice-sse-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-tests.js'),
path.resolve(__dirname, '../../test/services/file/fileservice-uploaddownload-tests.js'),
path.resolve(__dirname, '../../test/common/connectionstringparsertests.js'),
path.resolve(__dirname, '../../test/common/secondarytests.js'),
path.resolve(__dirname, '../../test/common/servicesettingstests.js'),
path.resolve(__dirname, '../../test/common/servicestatstests.js'),
path.resolve(__dirname, '../../test/common/sharedkey-tests.js'),
path.resolve(__dirname, '../../test/common/storageserviceclienttests.js'),
path.resolve(__dirname, '../../test/common/storageservicesettingstests.js'),
path.resolve(__dirname, '../../test/common/filters/exponentialretrypolicyfilter-tests.js'),
path.resolve(__dirname, '../../test/common/filters/linearretrypolicyfilter-tests.js'),
path.resolve(__dirname, '../../test/common/util/iso8061date-tests.js'),
path.resolve(__dirname, '../../test/common/util/util-tests.js'),
path.resolve(__dirname, '../../test/common/util/validate-tests.js'),
path.resolve(__dirname, '../../test/azure-tests.js'),
path.resolve(__dirname, '../../test/accountsas-tests.js'),
path.resolve(__dirname, './file/fileservice-upload.js'),
path.resolve(__dirname, './blob/blobservice-upload.js')
], { require: ['https'] }).bundle();

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

@ -30,7 +30,7 @@ if (testUtil.isBrowser()) {
describe('FileServiceUpload', function () {
before(function (done) {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']);
fileService = testUtil.getFileService(azure);
assert.notEqual(null, fileService, 'FileService should not be null');
shareName = suite.getName(shareNamesPrefix);

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

@ -40,10 +40,8 @@ module.exports = function (config) {
// environment values MUST be exported or set with same console running "karma start"
// https://www.npmjs.com/package/karma-env-preprocessor
envPreprocessor: [
'AZURE_STORAGE_CONNECTION_STRING',
'AZURE_STORAGE_CONNECTION_STRING_SSE_ENABLED_ACCOUNT',
'AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT',
'AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT'
'AZURE_ACCOUNT',
'AZURE_SAS'
],
// test results reporter to use

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

@ -148,7 +148,7 @@ describe('azure', function () {
assert.strictEqual(queueServiceWithTokenCredential.storageCredentials.tokenCredential.get(), 'renewed');
});
it('NotEmulatedExplicitCredentials', function (done) {
skipBrowser('NotEmulatedExplicitCredentials', function (done) {
// Make sure is not emulated
delete process.env[StorageServiceClientConstants.EnvironmentVariables.EMULATED];
@ -172,7 +172,7 @@ describe('azure', function () {
done();
});
it('EmulatedExplicitCredentials', function (done) {
skipBrowser('EmulatedExplicitCredentials', function (done) {
// set emulated to true
process.env[StorageServiceClientConstants.EnvironmentVariables.EMULATED] = "true";

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

@ -62,7 +62,7 @@ describe('exponentialretrypolicyfilter-tests', function () {
}
suite.setupSuite(function () {
exponentialRetryPolicyFilter = new ExponentialRetryPolicyFilter();
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(exponentialRetryPolicyFilter);
tableService = testutil.getTableService(azure).withFilter(exponentialRetryPolicyFilter);
done();
});
});

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

@ -48,7 +48,7 @@ describe('linearretrypolicyfilter-tests', function () {
}
suite.setupSuite(function () {
linearRetryPolicyFilter = new LinearRetryPolicyFilter();
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(linearRetryPolicyFilter);
tableService = testutil.getTableService(azure).withFilter(linearRetryPolicyFilter);
done();
});
});

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

@ -33,7 +33,7 @@ var skipBrowser = testutil.itSkipBrowser();
describe('StorageServiceClientTests', function () {
it('devStore', function (done) {
skipBrowser('devStore', function (done) {
var devStoreCreds = azure.generateDevelopmentStorageCredentials();
var devStoreBlobService = azure.createBlobService(devStoreCreds);

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

@ -20,6 +20,21 @@ var assert = require('assert');
var testutil = require('../../framework/util');
var Validate = require('../../../lib/common/util/validate');
if (!String.prototype.includes) {
String.prototype.includes = function(search, start) {
'use strict';
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
} else {
return this.indexOf(search, start) !== -1;
}
};
}
describe('validator-tests', function () {
it('isValidEnumValue should work', function (done) {
Validate.isValidEnumValue('a', ['a', 'b', 'c']).should.be.ok;
@ -28,7 +43,7 @@ describe('validator-tests', function () {
Validate.isValidEnumValue('d', ['a', 'b', 'c']);
},
function(err) {
return (err instanceof RangeError) && err.message === 'Invalid value: d. Options are: a,b,c.';
return (err instanceof RangeError) && err.message.includes('Invalid value: d. Options are');
}
);
done();
@ -302,7 +317,7 @@ describe('validator-tests', function () {
Validate.blobTypeIsValid('something');
},
function(err) {
return (err instanceof RangeError) && err.message === 'Invalid value: something. Options are: BlockBlob,PageBlob,AppendBlob.';
return (err instanceof RangeError) && err.message.includes('Invalid value: something. Options are:');
}
);
done();

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

@ -20,6 +20,7 @@ var os = require('os');
var path = require('path');
var guid = require('uuid');
var nockHelper = require('./nock-helper');
var testutil = require('./util');
exports = module.exports = TestSuite;
@ -50,6 +51,20 @@ function TestSuite(testPrefix, env, forceMocked) {
secure: stripAccessKey,
optional: true
}];
if (testutil.isBrowser()) {
requiredEnvironment = [{
name: 'AZURE_ACCOUNT',
secure: stripAccessKey,
optional: false
},{
name: 'AZURE_SAS',
secure: stripAccessKey,
optional: false
}
]
}
env = env.concat(requiredEnvironment);
this.testPrefix = testPrefix;
@ -77,6 +92,8 @@ function TestSuite(testPrefix, env, forceMocked) {
process.env['AZURE_STORAGE_CONNECTION_STRING'] = window.__env__['AZURE_STORAGE_CONNECTION_STRING'];
process.env['AZURE_STORAGE_CONNECTION_STRING_SSE_ENABLED_ACCOUNT'] = window.__env__['AZURE_STORAGE_CONNECTION_STRING_SSE_ENABLED_ACCOUNT'];
process.env['AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT'] = window.__env__['AZURE_STORAGE_CONNECTION_STRING_BLOB_ACCOUNT'];
process.env['AZURE_ACCOUNT'] = window.__env__['AZURE_ACCOUNT'];
process.env['AZURE_SAS'] = window.__env__['AZURE_SAS'];
// Premium blob storage account doesn't support CORS currently
// process.env['AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT'] = window.__env__['AZURE_STORAGE_CONNECTION_STRING_PREMIUM_ACCOUNT'];

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

@ -160,6 +160,54 @@ exports.itSkipMockAndBrowser = function (isMocked) {
return exports.isBrowser() ? it.skip : exports.itSkipMock(isMocked);
}
exports.getQueueService = function (azure) {
if (exports.isBrowser()) {
var account = process.env['AZURE_ACCOUNT'];
var host = "https://" + account + ".queue.core.windows.net";
var sas = process.env['AZURE_SAS'];
return azure.createQueueServiceWithSas(host, sas);
} else {
var connectionString = process.env['AZURE_STORAGE_CONNECTION_STRING'];
return azure.createQueueService(connectionString).withFilter(new azure.ExponentialRetryPolicyFilter());
}
};
exports.getTableService = function (azure) {
if (exports.isBrowser()) {
var account = process.env['AZURE_ACCOUNT'];
var host = "https://" + account + ".table.core.windows.net";
var sas = process.env['AZURE_SAS'];
return azure.createTableServiceWithSas(host, sas);
} else {
var connectionString = process.env['AZURE_STORAGE_CONNECTION_STRING'];
return azure.createTableService(connectionString).withFilter(new azure.ExponentialRetryPolicyFilter());
}
};
exports.getFileService = function (azure) {
if (exports.isBrowser()) {
var account = process.env['AZURE_ACCOUNT'];
var host = "https://" + account + ".file.core.windows.net";
var sas = process.env['AZURE_SAS'];
return azure.createFileServiceWithSas(host, sas);
} else {
var connectionString = process.env['AZURE_STORAGE_CONNECTION_STRING'];
return azure.createFileService(connectionString).withFilter(new azure.ExponentialRetryPolicyFilter());
}
};
exports.getBlobService = function (azure, connectionStringEnv) {
if (exports.isBrowser()) {
var account = process.env['AZURE_ACCOUNT'];
var host = "https://" + account + ".blob.core.windows.net";
var sas = process.env['AZURE_SAS'];
return azure.createBlobServiceWithSas(host, sas);
} else {
var connectionString = process.env[connectionStringEnv || 'AZURE_STORAGE_CONNECTION_STRING'];
return azure.createBlobService(connectionString).withFilter(new azure.ExponentialRetryPolicyFilter());
}
};
exports.polyfillArrayFind = function () {
// https://tc39.github.io/ecma262/#sec-array.prototype.find
if (!Array.prototype.find && exports.isBrowser()) {

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -48,7 +48,7 @@ describe('BlobContainer', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
blobService = testutil.getBlobService(azure);
done();
});
});
@ -482,7 +482,7 @@ describe('BlobContainer', function () {
});
describe('getContainerAcl', function () {
it('should work', function (done) {
skipBrowser('should work', function (done) {
blobService.getContainerAcl(containerName, function (containerAclError, containerBlob, containerAclResponse) {
assert.equal(containerAclError, null);
assert.notEqual(containerBlob, null);
@ -501,7 +501,7 @@ describe('BlobContainer', function () {
});
describe('setContainerAcl', function () {
it('should work', function (done) {
skipBrowser('should work', function (done) {
var blobServiceAnonymous = azure.createBlobServiceAnonymous(blobService.host.primaryHost)
.withFilter(new azure.ExponentialRetryPolicyFilter());
@ -564,7 +564,7 @@ describe('BlobContainer', function () {
});
});
it('should work with policies', function (done) {
skipBrowser('should work with policies', function (done) {
var readWriteStartDate = new Date(Date.UTC(2012, 10, 10));
var readWriteExpiryDate = new Date(readWriteStartDate);
readWriteExpiryDate.setMinutes(readWriteStartDate.getMinutes() + 10);
@ -617,7 +617,7 @@ describe('BlobContainer', function () {
});
});
it('should work with signed identifiers', function (done) {
skipBrowser('should work with signed identifiers', function (done) {
var signedIdentifiers = {
id1: {
Start: '2009-10-10T00:00:00.123Z',
@ -842,6 +842,9 @@ describe('BlobContainer', function () {
assert.equal(blobs.length, 2);
var sourceUrl = blobService.getUrl(containerName, blobName1);
if (testutil.isBrowser) {
sourceUrl += process.env["AZURE_SAS"];
}
var blobName3 = suite.getName(blobNamesPrefix);
blobService.startCopyBlob(sourceUrl, containerName, blobName3, function (copyErr) {
assert.equal(copyErr, null);

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

@ -41,7 +41,7 @@ describe('BlobServiceLeasing', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
blobService = testutil.getBlobService(azure);
done();
});
});

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

@ -79,7 +79,7 @@ describe('BlobService', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
blobService = testutil.getBlobService(azure);
done();
});
});
@ -1292,7 +1292,11 @@ describe('BlobService', function () {
blobService.createBlockBlobFromText(sourceContainerName, sourceBlobName, blobText, function (uploadErr) {
assert.equal(uploadErr, null);
blobService.startCopyBlob(blobService.getUrl(sourceContainerName, sourceBlobName), targetContainerName, targetBlobName, function (copyErr, copyRes) {
var sourceURL = blobService.getUrl(sourceContainerName, sourceBlobName);
if (testutil.isBrowser()) {
sourceURL += process.env["AZURE_SAS"];
}
blobService.startCopyBlob(sourceURL, targetContainerName, targetBlobName, function (copyErr, copyRes) {
assert.equal(copyErr, null);
blobService.abortCopyBlob(targetContainerName, targetBlobName, copyRes.copyId, function (copyErr) {
@ -1344,7 +1348,11 @@ describe('BlobService', function () {
assert.ok(snapshotResponse.isSuccessful);
}
blobService.startCopyBlob(blobService.getUrl(sourceContainerName, sourceBlobName), targetContainerName, targetBlobName, {'snapshotId': snapshotId}, function (copyErr, copyRes) {
var sourceURL = blobService.getUrl(sourceContainerName, sourceBlobName);
if (testutil.isBrowser()) {
sourceURL += process.env["AZURE_SAS"];
}
blobService.startCopyBlob(sourceURL, targetContainerName, targetBlobName, {'snapshotId': snapshotId}, function (copyErr, copyRes) {
assert.equal(copyErr, null);
blobService.getBlobToText(targetContainerName, targetBlobName, function (downloadErr, text) {
assert.equal(downloadErr, null);
@ -1365,7 +1373,7 @@ describe('BlobService', function () {
});
});
runOrSkip('incremental copy should work', function(done) {
skipMockAndBrowser('incremental copy should work', function(done) {
var sourceContainerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var targetContainerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
@ -1451,7 +1459,7 @@ describe('BlobService', function () {
describe('shared access signature', function () {
describe('getBlobUrl', function () {
it('should work', function (done) {
skipBrowser('should work', function (done) {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
@ -1510,7 +1518,7 @@ describe('BlobService', function () {
done();
});
it('should work with shared access policy', function (done) {
skipBrowser('should work with shared access policy', function (done) {
var containerName = 'container';
var blobName = 'blob';
@ -1597,7 +1605,7 @@ describe('BlobService', function () {
});
});
it('GenerateSharedAccessSignature', function (done) {
skipBrowser('GenerateSharedAccessSignature', function (done) {
var containerName = 'images';
var blobName = 'pic1.png';
@ -1626,7 +1634,7 @@ describe('BlobService', function () {
done();
});
runOrSkip('should be able to append block to AppendBlob using SharedAccessSignature', function (done) {
skipMockAndBrowser('should be able to append block to AppendBlob using SharedAccessSignature', function (done) {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING'])
@ -1674,7 +1682,7 @@ describe('BlobService', function () {
});
});
runOrSkip('should be able to download blob using SharedAccessSignature', function (done) {
skipMockAndBrowser('should be able to download blob using SharedAccessSignature', function (done) {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING'])
@ -1731,7 +1739,7 @@ describe('BlobService', function () {
});
});
it('should NOT be able to specify api-version in SAS', function (done) {
skipMockAndBrowser('should NOT be able to specify api-version in SAS', function (done) {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
@ -1750,7 +1758,7 @@ describe('BlobService', function () {
done();
});
runOrSkip('should append api-version', function (done) {
skipMockAndBrowser('should append api-version', function (done) {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING'])
@ -1801,7 +1809,7 @@ describe('BlobService', function () {
});
describe('SasStrangeChars', function() {
runOrSkip('SasStrangeCharsBlobName', function (done) {
skipMockAndBrowser('SasStrangeCharsBlobName', function (done) {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = 'def@#/abef?def/& &/abcde+=-';
var blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
@ -1845,7 +1853,7 @@ describe('BlobService', function () {
var blobText = 'sampletext!';
before(function (done) {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
blobService = testutil.getBlobService(azure);
done();
})
@ -1862,7 +1870,7 @@ describe('BlobService', function () {
});
});
runOrSkip('should work', function(done) {
skipMockAndBrowser('should work', function(done) {
blobService.createBlockBlobFromText(containerName, blobName, blobText, function (error2) {
assert.equal(error2, null);
@ -1903,7 +1911,9 @@ describe('BlobService', function () {
var containerName = testutil.generateId(containerNamesPrefix, containerNames, suite.isMocked);
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var blobText = 'hi there';
var timeBeforeCreation = new Date().toUTCString();
var timeBeforeCreation = new Date();
timeBeforeCreation.setMinutes(timeBeforeCreation.getMinutes() - 5);
timeBeforeCreation = timeBeforeCreation.toUTCString();
var lastModified;
var etag;
@ -2021,7 +2031,7 @@ describe('BlobService', function () {
});
// Even the execution time is 1ms in this case, we need skip it in nock as it may receive response in less than 1ms when it is mocked.
runOrSkip('maximumExecutionTime should work', function (done) {
skipMockAndBrowser('maximumExecutionTime should work', function (done) {
//set the maximum execution time.
var options = {
maximumExecutionTimeInMs: 1,
@ -2064,7 +2074,7 @@ describe('BlobService', function () {
});
});
it('storageConnectionStrings', function (done) {
skipBrowser('storageConnectionStrings', function (done) {
var key = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
var connectionString = 'DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=' + key;
var blobService = azure.createBlobService(connectionString);
@ -2076,7 +2086,7 @@ describe('BlobService', function () {
done();
});
it('storageConnectionStringsDevStore', function (done) {
skipBrowser('storageConnectionStringsDevStore', function (done) {
var connectionString = 'UseDevelopmentStorage=true';
var blobService = azure.createBlobService(connectionString);

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

@ -166,7 +166,7 @@ describe('blob-uploaddownload-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
blobService = azure.createBlobService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
blobService = testutil.getBlobService(azure);
//blobService.logger.level = azure.Logger.LogLevels.DEBUG;
done();
});
@ -279,13 +279,6 @@ describe('blob-uploaddownload-tests', function () {
});
});
skipBrowser('returns correct error when specifying invalid content-length', function (done) {
blobService.createBlockFromStream('test', containerName, blockBlobName, rfs.createReadStream(blockFileName), 'invalidlength', function (error) {
assert.ok(error.message.indexOf('invalid content length') !== -1);
done();
});
});
describe('blob-piping-tests', function() {
skipMockAndBrowser('should be able to upload block blob from piped stream', function (done) {
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
@ -911,7 +904,7 @@ describe('blob-uploaddownload-tests', function () {
});
});
it('createBlockFromUrl should work', function(done) {
skipBrowser('createBlockFromUrl should work', function(done) {
var blobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var destBlobName = testutil.generateId(blobNamesPrefix, blobNames, suite.isMocked);
var blobText = 'Hello World!';

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

@ -46,7 +46,7 @@ describe('FileDirectory', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
fileService = testutil.getFileService(azure);
done();
});
});

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

@ -61,7 +61,7 @@ describe('File', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
fileService = testutil.getFileService(azure);
done();
});
});
@ -98,11 +98,11 @@ describe('File', function () {
var share = 'share';
var directory = 'directory';
var file = 'file'
var fileServiceForUrl = azure.createFileService('storageAccount', 'storageAccessKey');
var shareSnapshotId = '2017-05-10T04:40:00.0000000Z';
var url;
it('Directory and file', function (done) {
skipBrowser('Directory and file', function (done) {
var fileServiceForUrl = azure.createFileService('storageAccount', 'storageAccessKey');
fileServiceForUrl.setHost({ primaryHost: 'host.com' });
url = fileServiceForUrl.getUrl(share, directory, file, null, true);
assert.strictEqual(url, 'https://host.com/' + share + '/' + directory + '/' + file);
@ -158,7 +158,9 @@ describe('File', function () {
done();
});
it('No file', function (done) {
skipBrowser('No file', function (done) {
var fileServiceForUrl = azure.createFileService('storageAccount', 'storageAccessKey');
fileServiceForUrl.setHost({ primaryHost: 'host.com' });
url = fileServiceForUrl.getUrl(share, directory, null, null, true);
assert.strictEqual(url, 'https://host.com/' + share + '/' + directory);
@ -204,7 +206,9 @@ describe('File', function () {
done();
});
it('No directory', function (done) {
skipBrowser('No directory', function (done) {
var fileServiceForUrl = azure.createFileService('storageAccount', 'storageAccessKey');
fileServiceForUrl.setHost({ primaryHost: 'host.com' });
url = fileServiceForUrl.getUrl(share, '', null, null, true);
assert.strictEqual(url, 'https://host.com/' + share);
@ -858,7 +862,7 @@ describe('File', function () {
});
});
runOrSkip('should work with SAS', function (done) {
skipMockAndBrowser('should work with SAS', function (done) {
var sourceShareName = suite.getName(shareNamesPrefix);
var targetShareName = suite.getName(shareNamesPrefix);
@ -982,7 +986,7 @@ describe('File', function () {
});
runOrSkip('should work with a normal file name', function (done) {
skipMockAndBrowser('should work with a normal file name', function (done) {
var sasToken = fileService.generateSharedAccessSignature(shareName, directoryName, sasTestFileName, sharedAccessPolicy);
var fileServiceSAS = azure.createFileServiceWithSas(fileService.host, sasToken);
@ -1002,7 +1006,7 @@ describe('File', function () {
});
});
runOrSkip('should work with a file name with special characters', function (done) {
skipMockAndBrowser('should work with a file name with special characters', function (done) {
var sasToken = fileService.generateSharedAccessSignature(shareName, directoryName, sasTestFileNameWithSpecialChar, sharedAccessPolicy);
var fileServiceSAS = azure.createFileServiceWithSas(fileService.host, sasToken);

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

@ -48,7 +48,7 @@ describe('FileShare', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
fileService = testutil.getFileService(azure);
done();
});
});
@ -559,7 +559,7 @@ describe('FileShare', function () {
});
describe('shared access signature', function () {
it('should work with shared access policy', function (done) {
skipBrowser('should work with shared access policy', function (done) {
var share = 'testshare';
var directoryName = "testdir";
var fileName = "testfile";
@ -582,7 +582,7 @@ describe('FileShare', function () {
});
// Skip this case in nock because the signing key is different between live run and mocked run
runOrSkip('should work with share and file policies', function (done) {
skipMockAndBrowser('should work with share and file policies', function (done) {
var readWriteSharePolicy = {
AccessPolicy: {
Permissions: 'rw',
@ -640,7 +640,7 @@ describe('FileShare', function () {
});
describe('getShareAcl', function () {
it('should work', function (done) {
skipBrowser('should work', function (done) {
fileService.createShareIfNotExists(shareName, function () {
fileService.getShareAcl(shareName, function (shareAclError, shareResult, shareAclResponse) {
assert.equal(shareAclError, null);
@ -656,7 +656,7 @@ describe('FileShare', function () {
});
describe('setShareAcl', function () {
it('should work with policies', function (done) {
skipBrowser('should work with policies', function (done) {
var readWriteStartDate = new Date(Date.UTC(2012, 10, 10));
var readWriteExpiryDate = new Date(readWriteStartDate);
readWriteExpiryDate.setMinutes(readWriteStartDate.getMinutes() + 10);
@ -716,7 +716,7 @@ describe('FileShare', function () {
});
});
it('should work with signed identifiers', function (done) {
skipBrowser('should work with signed identifiers', function (done) {
var signedIdentifiers = {
id1: {
Start: '2009-10-10T00:00:00.123Z',

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

@ -97,7 +97,7 @@ describe('FileShare', function () {
}
shareName = suite.getName(shareNamesPrefix);
suite.setupSuite(function () {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
fileService = testutil.getFileService(azure);
done();
});
});

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

@ -37,7 +37,7 @@ describe('FileService', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
fileService = testutil.getFileService(azure);
done();
});
});

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

@ -107,7 +107,7 @@ describe('FileUploadDownload', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
fileService = azure.createFileService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
fileService = testutil.getFileService(azure);
done();
});
});

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

@ -64,7 +64,7 @@ describe('QueueServiceTests', function() {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
queueService = azure.createQueueService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
queueService = testutil.getQueueService(azure);
done();
});
});
@ -885,7 +885,7 @@ describe('QueueServiceTests', function() {
});
describe('ConnectionStringTests', function () {
it('should work', function (done) {
skipBrowser('should work', function (done) {
var key = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA==';
var connectionString = 'DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=' + key;
var queueService = azure.createQueueService(connectionString);
@ -901,7 +901,7 @@ describe('QueueServiceTests', function() {
done();
});
it('should work with dev store', function (done) {
skipBrowser('should work with dev store', function (done) {
var connectionString = 'UseDevelopmentStorage=true';
var queueService = azure.createQueueService(connectionString);
@ -1002,7 +1002,7 @@ describe('QueueServiceTests', function() {
});
describe('Queue ACL', function() {
it('setQueueACL and getQueueACL should work', function(done) {
skipBrowser('setQueueACL and getQueueACL should work', function(done) {
queueService.createQueueIfNotExists(queueName, function() {
var startDate = new Date('2015-01-01T12:00:00.0000000Z');
var expiryDate = new Date(startDate);
@ -1031,7 +1031,7 @@ describe('QueueServiceTests', function() {
});
describe('testSAS', function() {
runOrSkip('should work with noPolicy', function(done) {
skipMockAndBrowser('should work with noPolicy', function(done) {
queueService.createQueueIfNotExists(queueName, function() {
var text = 'Sample message text';
queueService.createMessage(queueName, text, function() {
@ -1068,7 +1068,7 @@ describe('QueueServiceTests', function() {
});
// Skip this case in nock because the signing key is different between live run and mocked run
runOrSkip('should work with policy', function(done) {
skipMockAndBrowser('should work with policy', function(done) {
queueService.createQueueIfNotExists(queueName, function() {
var text = 'Sample message text';
queueService.createMessage(queueName, text, function() {
@ -1115,7 +1115,7 @@ describe('QueueServiceTests', function() {
});
describe('getUrl', function(){
it('should work', function(done) {
skipBrowser('should work', function(done) {
var queueName = 'queue1';
var queueService = azure.createQueueService('storageAccount', 'storageAccessKey', {primaryHost: 'https://host.com:80/', secondaryHost: 'https://host-secondary.com:80/'});
@ -1140,7 +1140,7 @@ describe('QueueServiceTests', function() {
done();
});
it('should work against storage emulator', function(done) {
skipBrowser('should work against storage emulator', function(done) {
var queueName = 'queue1';
var queueService = azure.createQueueService('storageAccount', 'storageAccessKey', {primaryHost: 'https://host.com:80/account1', secondaryHost: 'https://host-secondary.com:80/account1'});

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

@ -137,7 +137,7 @@ describe('batchserviceclient-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
tableService = testutil.getTableService(azure);
done();
});
});

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

@ -94,7 +94,7 @@ describe('tabledatatype-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
tableService = testutil.getTableService(azure);
done();
});
});

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

@ -95,7 +95,7 @@ describe('tableservice-payload-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
tableService = testutil.getTableService(azure);
done();
});
});

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

@ -96,7 +96,7 @@ describe('tablequery-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
tableService = testutil.getTableService(azure);
done();
});
});

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

@ -42,7 +42,7 @@ describe('tableservice-gb-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
tableService = testutil.getTableService(azure);
done();
});
});

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

@ -99,7 +99,7 @@ describe('tableservice-tests', function () {
testutil.POLL_REQUEST_INTERVAL = 0;
}
suite.setupSuite(function () {
tableService = azure.createTableService(process.env['AZURE_STORAGE_CONNECTION_STRING']).withFilter(new azure.ExponentialRetryPolicyFilter());
tableService = testutil.getTableService(azure);
done();
});
});
@ -131,7 +131,7 @@ describe('tableservice-tests', function () {
});
});
it('SetDefaultPortProperly', function (done) {
skipBrowser('SetDefaultPortProperly', function (done) {
var storageAccount = 'account';
var storageAccountKey = Buffer.from('key').toString('base64');
@ -881,7 +881,7 @@ describe('tableservice-tests', function () {
});
describe('Table ACL', function() {
it('setTableACL and getTableACL should work', function(done) {
skipBrowser('setTableACL and getTableACL should work', function(done) {
tableService.createTableIfNotExists(tableName1, function() {
var startDate = new Date('2015-01-01T12:00:00.0000000Z');
var expiryDate = new Date(startDate.toISOString());
@ -912,7 +912,7 @@ describe('tableservice-tests', function () {
});
describe('SAS', function () {
runOrSkip('SASNoPolicy', function (done) {
skipMockAndBrowser('SASNoPolicy', function (done) {
tableService.createTable(tableName1, function (error1) {
assert.equal(error1, null);
insertManyEntities(function () {
@ -942,7 +942,7 @@ describe('tableservice-tests', function () {
});
});
runOrSkip('SASNoPolicyWithUpperCaseTableName', function (done) {
skipMockAndBrowser('SASNoPolicyWithUpperCaseTableName', function (done) {
var tableName = tableName1.toUpperCase();
tableService.createTable(tableName, function (error1) {
assert.equal(error1, null);
@ -974,7 +974,7 @@ describe('tableservice-tests', function () {
});
// Skip this case in nock because the signing key is different between live run and mocked run
runOrSkip('SASWithPolicy', function(done) {
skipMockAndBrowser('SASWithPolicy', function(done) {
tableService.createTable(tableName1, function (error1) {
assert.equal(error1, null);
insertManyEntities(function () {
@ -1040,7 +1040,7 @@ describe('tableservice-tests', function () {
});
describe('getUrl', function(){
it('should work', function(done) {
skipBrowser('should work', function(done) {
var tableName = 'table1';
var tableService = azure.createTableService('storageAccount', 'storageAccessKey', {primaryHost: 'https://host.com:80/', secondaryHost: 'https://host-secondary.com:80/'});
@ -1065,7 +1065,7 @@ describe('tableservice-tests', function () {
done();
});
it('should work against storage emulator', function(done) {
skipBrowser('should work against storage emulator', function(done) {
var tableName = 'table1';
var tableService = azure.createTableService('storageAccount', 'storageAccessKey', {primaryHost: 'https://host.com:80/account1', secondaryHost: 'https://host-secondary.com:80/account1'});