Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Head Exception Operations', function () {
var testOptions = clientOptions;
testOptions.requestOptions = { jar: true };
testOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
testOptions.noRetryPolicy = true;
var testClient = new headExceptionClient(credentials, baseUri, clientOptions);
it('should return true for 200 status code', function (done) {
testClient.headException.head200(function (error, result) {
should.not.exist(error);
done();
});
});
it('should return true for 204 status code', function (done) {
testClient.headException.head204(function (error, result) {
should.not.exist(error);
done();
});
});
describe('Swagger LRO Happy BAT', function () {
clientOptions.requestOptions = { jar: true };
clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
clientOptions.noRetryPolicy = true;
clientOptions.longRunningOperationRetryTimeout = 0;
var testClient = new lroClient(credentials, baseUri, clientOptions);
var product = { location: 'West US' };
it('should work with Put201CreatingSucceeded200', function (done) {
testClient.lROs.put201CreatingSucceeded200(product, function (error, result) {
should.not.exist(error);
done();
});
});
it('should work with Put201CreatingFailed200', function (done) {
testClient.lROs.put201CreatingFailed200(product, function (error, result) {
should.exist(error);
error.message.should.be.exactly('Long running operation failed with status: \'Failed\'.');
describe('Swagger LRO Sad BAT', function () {
clientOptions.requestOptions = { jar: true };
clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
clientOptions.noRetryPolicy = true;
var testClient = new lroClient(credentials, baseUri, clientOptions);
testClient.longRunningOperationRetryTimeout = 0;
var product = { location: 'West US' };
//TODO: Port more C# test case over after 4103936 Fix exception type
it('should throw on PutNonRetry400', function (done) {
testClient.lROSADs.putNonRetry400(product, function (error, result) {
should.exist(error);
error.message.should.containEql('{"message":"Expected bad request message","status":400}');
done();
});
});
describe('Pageable Operations', function () {
clientOptions.requestOptions = { jar: true };
clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
clientOptions.noRetryPolicy = true;
var testClient = new pagingClient(credentials, baseUri, clientOptions);
it('should get single pages', function (done) {
testClient.paging.getSinglePages(function (error, result) {
should.not.exist(error);
should.not.exist(result.nextLink);
done();
});
});
it('should get multiple pages', function (done) {
testClient.paging.getMultiplePages({'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (error, result) {
var loop = function (nextLink, count) {
if (nextLink !== null && nextLink !== undefined) {
testClient.paging.getMultiplePagesNext(nextLink, {'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (err, res) {
describe('Head Operations', function () {
var testOptions = clientOptions;
testOptions.requestOptions = { jar: true };
testOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
testOptions.noRetryPolicy = true;
var testClient = new headClient(credentials, baseUri, clientOptions);
it('should return true for 200 status code', function (done) {
testClient.httpSuccess.head200(function (error, result) {
should.not.exist(error);
result.should.be.exactly(true);
done();
});
});
it('should return true for 204 status code', function (done) {
testClient.httpSuccess.head204(function (error, result) {
should.not.exist(error);
result.should.be.exactly(true);
done();
describe('Pageable Operations', function () {
clientOptions.requestOptions = { jar: true };
clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
clientOptions.noRetryPolicy = true;
var testClient = new pagingClient(credentials, baseUri, clientOptions);
it('should get single pages', function (done) {
testClient.paging.getSinglePages(function (error, result) {
should.not.exist(error);
should.not.exist(result.nextLink);
done();
});
});
it('should get multiple pages', function (done) {
testClient.paging.getMultiplePages({'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (error, result) {
var loop = function (nextLink, count) {
if (nextLink !== null && nextLink !== undefined) {
testClient.paging.getMultiplePagesNext(nextLink, {'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (err, res) {
describe('Resource Flattening Operations', function () {
var testOptions = clientOptions;
testOptions.requestOptions = { jar: true };
testOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
testOptions.noRetryPolicy = true;
var testClient = new flatteningClient(credentials, baseUri, clientOptions);
it('should get external resource as an array', function (done) {
var expectedResult = [
{
id: '1',
location: 'Building 44',
name: 'Resource1',
properties: {
provisioningState: 'Succeeded',
provisioningStateValues: 'OK',
pname: 'Product1',
type: 'Flat'
},
tags: { tag1: 'value1', tag2: 'value3' },
describe('Swagger LRO Happy BAT', function () {
clientOptions.requestOptions = { jar: true };
clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
clientOptions.noRetryPolicy = true;
clientOptions.longRunningOperationRetryTimeout = 0;
var testClient = new lroClient(credentials, baseUri, clientOptions);
var product = { location: 'West US' };
it('should work with Put201CreatingSucceeded200', function (done) {
testClient.lROs.put201CreatingSucceeded200(product, function (error, result) {
should.not.exist(error);
done();
});
});
it('should work with Put201CreatingFailed200', function (done) {
testClient.lROs.put201CreatingFailed200(product, function (error, result) {
should.exist(error);
error.message.should.be.exactly('Long running operation failed with status: "Failed".');