Skip to content

Instantly share code, notes, and snippets.

@sedouard
Created April 17, 2015 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sedouard/808288c0c0d82276814e to your computer and use it in GitHub Desktop.
Save sedouard/808288c0c0d82276814e to your computer and use it in GitHub Desktop.
nodeServices.set('azureStorage', {
createBlobService: function () {
return {
listContainersSegmented: function (shouldBeNull, callback){
assert.ok(shouldBeNull === null, 'expeceted arg shouldBeNull to be null');
assert.ok(callback !== null, 'expeceted arg callback to be non-null');
return callback(null, {
entries: [{
name: 'testcontainer',
properties: {
'last-modified': new Date(Date.now())
}
}, {
name: 'testcontainer2',
properties: {
'last-modified': new Date(Date.now())
}
}]
});
},
/.../
createContainerIfNotExists: function (containerName, callback) {
assert.ok(containerName !== null, 'expeceted arg containerName to be non-null');
assert.ok(callback !== null, 'expeceted arg callback to be non-null');
return callback(null);
},
listBlobsSegmented: function (containerName, shouldBeNull, callback) {
assert.ok(containerName !== null, 'expeceted arg containerName to be non-null');
assert.ok(shouldBeNull === null, 'expeceted arg shouldBeNull to be null');
assert.ok(callback !== null, 'expeceted arg callback to be non-null');
return callback(null, {
entries: [{
name: 'test-blob-1.mp4',
properties: {
'content-type': 'video/mpeg4',
'content-length': 12313435,
'last-modified': new Date(Date.now())
}
},
/.../
{
name: 'test-blob-4.mp3',
properties: {
'content-type': 'audio/mp3',
'content-length': 12313435,
'last-modified': new Date(Date.now())
}
}]
});
},
generateSharedAccessSignature: function () {
assert.ok(true);
// litterally just mashed my keyboard here :-)
return '32523fdsgjsdkh5r43r89hvsghsdhafkjwerhs';
},
getUrl: function () {
assert.ok(true);
return 'https://testaccount.storage.windows.net/somecontainer/test-blob?expiry=2000';
},
BlobUtilities: {
SharedAccessPermissions: {
READ: 'READ'
}
}
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment