assert(framework, 'Expected global framework to be truthy, not: '+framework);assert(typeof framework === 'object', 'Expected framework to be an object, not: '+(typeof framework));assert(framework.assert, 'Expected framework.assert to be truthy, not: '+framework.assert);assert(typeof framework.assert === 'function', 'Expected framework.assert to be a function, not: '+(typeof framework.assert));assert(framework.url, 'Expected framework.url to be truthy, not: '+framework.url);assert(typeof framework.url === 'object', 'Expected framework.url to be an object, not: '+(typeof framework.url));assert(framework.path, 'Expected framework.path to be truthy, not: '+framework.path);assert(typeof framework.path === 'object', 'Expected framework.path to be an object, not: '+(typeof framework.path));assert(framework.qs, 'Expected framework.qs to be truthy, not: '+framework.qs);assert(typeof framework.qs === 'object', 'Expected framework.qs to be an object, not: '+(typeof framework.qs));assert(framework.inspect, 'Expected framework.inspect to be truthy, not: '+framework.inspect);assert(typeof framework.inspect === 'function', 'Expected framework.inspect to be a function, not: '+(typeof framework.inspect));assert(framework.exec, 'Expected framework.exec to be truthy, not: '+framework.exec);assert(typeof framework.exec === 'function', 'Expected framework.exec to be a function, not: '+(typeof framework.exec));assert(framework.throwsError, 'Expected framework.throwsError to be truthy, not: '+framework.throwsError);assert(typeof framework.throwsError === 'function', 'Expected framework.throwsError to be a function, not: '+(typeof framework.throwsError));assert(framework.values, 'Expected framework.values to be truthy, not: '+framework.values);assert(typeof framework.values === 'object', 'Expected framework.values to be an object, not: '+(typeof framework.values));assert(framework.values.invalidParamList, 'Expected framework.values.invalidParamList to be truthy, not: '+framework.values.invalidParamList);assert(typeof framework.values.invalidParamList === 'object', 'Expected framework.values.invalidParamList to be an object, not: '+(typeof framework.values.invalidParamList));assert(framework.instanceMethodTests, 'Expected framework.instanceMethodTests to be truthy, not: ' + framework.instanceMethodTests);assert(typeof framework.instanceMethodTests === 'function', 'Expected framework.instanceMethodTests to be a function, not: ' + (typeof framework.instanceMethodTests));assert(framework.boxView, 'Expected framework.boxView to be truthy, not: '+framework.boxView);assert(typeof framework.boxView === 'object', 'Expected framework.boxView to be an object, not: '+(typeof framework.boxView));assert(typeof framework.boxView.validApiKey === 'string', 'Expected framework.boxView.validApiKey to be a string, not: '+(typeof framework.boxView.validApiKey));assert(typeof framework.boxView.validApiKey === 'string' && framework.boxView.validApiKey.length > 0, 'Expected framework.boxView.validApiKey to be non-blank');assert(typeof framework.boxView.dummyApiKey === 'string', 'Expected framework.boxView.dummyApiKey to be a string, not: ' + (typeof framework.boxView.dummyApiKey));assert(typeof framework.boxView.dummyApiKey === 'string' && framework.boxView.validApiKey.length > 0, 'Expected framework.boxView.dummyApiKey to be non-blank');framework.throwsError(function(){new API();});framework.throwsError(function(){new API(framework.boxView.dummyApiKey, 1);});framework.values.invalidParamList.forEach(function(e) {
framework.throwsError(function() {
new API(e.value);
}, 'Expected an error with an API Token of type '+e.name);
});new API(framework.boxView.dummyApiKey);framework.assert(typeof instance.uriString === 'function');framework.assert(typeof instance.post === 'function');framework.assert(typeof instance.put === 'function');framework.assert(typeof instance.get === 'function');framework.assert(typeof instance.del === 'function');framework.values.invalidParamList.forEach(function(e) {
framework.throwsError(function() {
instance.uriString(e.value);
}, 'Expected an error with a resource param of type '+e.name);
});framework.assert(uriResource === uriBase, 'URI is not correct URI base: '+uriResource);framework.assert(uriFromQS.indexOf(uriBase) === 0, 'URI does not start with resource URI: '+uriFromQS);framework.assert(uriFromQuery.indexOf(uriBase) === 0, 'URI does not start with resource URI: '+uriFromQuery);getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function() {
new API();
});framework.throwsError(function() {
new API(framework.boxView.dummyApiKey, 1);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});new API(framework.boxView.dummyApiKey);framework.assert(typeof instance.uploadUrl === 'function');framework.assert(typeof instance.list === 'function');framework.assert(typeof instance.info === 'function');framework.assert(typeof instance.changeName === 'function');framework.assert(typeof instance.download === 'function');framework.assert(typeof instance.remove === 'function');framework.assert(typeof instance.poll === 'function');getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function() {
new API();
});framework.throwsError(function() {
new API(framework.boxView.dummyApiKey, 1);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});framework.throwsError(function() {
new API(framework.values.invalidParamList[k].value);
});new API(framework.boxView.dummyApiKey);framework.assert(typeof instance.create === 'function');getInstance()[method].apply(getInstance(), goodParams[i].args);getInstance()[method].apply(getInstance(), goodParams[i].args);framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});framework.throwsError(function () {
getInstance()[method].apply(getInstance(), badParams[i].args);
});var url = 'http://web.crocodoc.com/files/test-simple.pdf';
var name = url;
this.timeout(pollTimeout);
framework.tempUuid.fromUrl(url, name, function(e, r, b) {
framework.assert(typeof b === 'object', 'Could not pre-load a document for the tests: e: '+ e +', typeof body: '+ typeof b + ' body: '+ framework.inspect(b, true, 1) );
preloadedUuid = b.id;
framework.tempUuid.waitFor(preloadedUuid, function(e, r, b) {
done();
});
});this.timeout(responseTimeout);
instance.list(function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);
expect(_ofn()[_pn]).to.be.an('object');expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(responseTimeout);
instance.info('non-existent docId', function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);this.timeout(responseTimeout);
instance.info(preloadedUuid, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(responseTimeout);
instance.uploadUrl('not a url', 'not a url', function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(responseTimeout);
instance.uploadUrl(url, name, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);framework.assert(typeof body.id === 'string' && body.id.length > 0, 'Expected body.id to be a non-empty string, not: ('+typeof body.id+'): '+body.id);
uuid = body.id;
framework.tempUuid.add(uuid);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(pollTimeout);
instance.poll(uuid, function(e, r, b) {
_fe = e;
_fr = r;
_fb = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(responseTimeout);
instance.download('non-existent docId', API.downloadTypes.zip, outputStream, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);framework.assert(fsUtils.isFile(outputFilename), 'Expected '+outputFilename+' to be a regular file');framework.assert(fsUtils.fileSize(outputFilename) === 0, 'Expected '+outputFilename+' to be zero length');this.timeout(responseTimeout);
instance.download(preloadedUuid, API.downloadTypes.zip, outputStream, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(Object.keys(objFn()).length).to.equal(0);framework.assert(fsUtils.isFile(outputFilename), 'Expected '+outputFilename+' to be a regular file');framework.assert(fsUtils.fileSize(outputFilename) > 0, 'Expected '+outputFilename+' not to be zero length');this.timeout(responseTimeout);
instance.download('non-existent docId', API.downloadTypes.pdf, outputStream, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);framework.assert(fsUtils.isFile(outputFilename), 'Expected '+outputFilename+' to be a regular file');framework.assert(fsUtils.fileSize(outputFilename) === 0, 'Expected '+outputFilename+' to be zero length');this.timeout(responseTimeout);
instance.download(preloadedUuid, API.downloadTypes.pdf, outputStream, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(Object.keys(objFn()).length).to.equal(0);framework.assert(fsUtils.isFile(outputFilename), 'Expected '+outputFilename+' to be a regular file');framework.assert(fsUtils.fileSize(outputFilename) > 0, 'Expected '+outputFilename+' not to be zero length');this.timeout(responseTimeout);
instance.remove('non-existent docId', function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);this.timeout(responseTimeout);
instance.remove(preloadedUuid, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.not.have.a.property(_pn);expect(objFn()).to.have.keys(keys);var url = 'http://web.crocodoc.com/files/test-simple.pdf';
var name = url;
this.timeout(pollTimeout);
framework.tempUuid.fromUrl(url, name, function(e, r, b) {
framework.assert(typeof b === 'object', 'Could not pre-load a document for the tests: e: ' + e + ', typeof body: ' + typeof b + ' body: ' + framework.inspect(b, true, 1));
preloadedUuid = b.id;
framework.tempUuid.waitFor(preloadedUuid, function (e, r, b) {
done();
});
});this.timeout(responseTimeout);
instance.create(preloadedUuid, function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(responseTimeout);
instance.create('maformed id', function (e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);this.timeout(responseTimeout);
instance.create('non-existent docId xxxxxxxxxxxxx', function(e, r, b) {
error = e;
response = r;
body = b;
done();
});framework.assert(r().statusCode === statusCode, 'Expected status code to be ' + statusCode + ', not ' + r().statusCode);framework.assert(r(), 'Expected response to be truthy, not: '+r());framework.assert(r().headers, 'Expected response headers to be truthy, not: '+r().headers);framework.assert(b(), 'Expected body to be truthy, not: '+b());framework.assert(!e(), 'Expected error to be falsey, not: ' + e());var contentType = r().headers['content-type'];
framework.assert((typeof contentType === 'string') && contentType.toLowerCase().indexOf(mimeType) >= 0, 'Expected content type to be ' + mimeType + ', not: ' + contentType);expect(_ofn()).to.be.an('object');expect(_ofn()).to.have.a.property(_pn);expect(objFn()).to.have.keys(keys);if (_t.indexOf('?') === 0) {
_t = _t.substring(1);
if (_ofn()[_pn] === null) {
// it's ok for something to be null if it's type string starts with a '?'
return;
}
}
expect(_ofn()[_pn]).to.be.a(_t);expect(_ofn()[_pn]).to.equal(_v);