Commit c42210b1 authored by Tristan Cavelier's avatar Tristan Cavelier

jslint s3storage tests

parent 1d4f0fe6
...@@ -19,22 +19,22 @@ ...@@ -19,22 +19,22 @@
}; };
} }
module("Amazon S3 Storage"); module("Amazon S3 Storage");
/* /*
Post without id Post without id
Create = POST non empty document Create = POST non empty document
Post but document already exists Post but document already exists
*/ */
test ("Post", function(){ test("Post", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com" "url": "https://jiobucket.s3.amazonaws.com"
}); });
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
...@@ -51,7 +51,7 @@ test ("Post", function(){ ...@@ -51,7 +51,7 @@ test ("Post", function(){
[204, {}, "HTML Response"] [204, {}, "HTML Response"]
); );
//o.spy (o, "status", 405, "Post without id"); //o.spy(o, "status", 405, "Post without id");
o.spy(o, "jobstatus", "done", "Post without ID"); o.spy(o, "jobstatus", "done", "Post without ID");
o.jio.post({}, o.f); o.jio.post({}, o.f);
o.clock.tick(1000); o.clock.tick(1000);
...@@ -72,7 +72,7 @@ test ("Post", function(){ ...@@ -72,7 +72,7 @@ test ("Post", function(){
[204, {}, "HTML Response"] [204, {}, "HTML Response"]
); );
o.spy(o, "value", {'ok':true,'id':'post1'}, "Post with ID"); o.spy(o, "value", {'ok': true, 'id': 'post1'}, "Post with ID");
o.jio.post({"_id": "post1", "title": "myPost1"}, o.f); o.jio.post({"_id": "post1", "title": "myPost1"}, o.f);
o.clock.tick(1000); o.clock.tick(1000);
...@@ -88,7 +88,7 @@ test ("Post", function(){ ...@@ -88,7 +88,7 @@ test ("Post", function(){
[200, {}, "HTML Response"] [200, {}, "HTML Response"]
); );
o.spy (o, "status", 409, "Post but document already exists (update)"); o.spy(o, "status", 409, "Post but document already exists (update)");
//o.spy(o, "jobstatus", "done", "Post without ID"); //o.spy(o, "jobstatus", "done", "Post without ID");
o.jio.post({"_id": "post2", "title": "myPost2"}, o.f); o.jio.post({"_id": "post2", "title": "myPost2"}, o.f);
o.clock.tick(1000); o.clock.tick(1000);
...@@ -97,28 +97,28 @@ test ("Post", function(){ ...@@ -97,28 +97,28 @@ test ("Post", function(){
o.server.restore(); o.server.restore();
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
/* /*
Put without id Put without id
Create = PUT non empty document Create = PUT non empty document
Updated the document Updated the document
*/ */
test("Put", function(){ test("Put", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"http://s3.amazonaws.com/jiobucket/put1" "url": "http://s3.amazonaws.com/jiobucket/put1"
}); });
// put without id => id required // put without id => id required
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.spy (o, "status", 20, "Put without id"); o.spy(o, "status", 20, "Put without id");
o.jio.put({}, o.f); o.jio.put({}, o.f);
o.clock.tick(5000); o.clock.tick(5000);
...@@ -128,17 +128,19 @@ test("Put", function(){ ...@@ -128,17 +128,19 @@ test("Put", function(){
//Put non empty document //Put non empty document
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[404, {}, "HTML Response"] [404, {}, "HTML Response"]
); );
o.server.respondWith("PUT", o.server.respondWith(
"PUT",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200, {}, "HTML Response"] [200, {}, "HTML Response"]
); );
o.spy (o, "value", {"ok": true, "id": "http://100%.json"}, o.spy(o, "value", {"ok": true, "id": "http://100%.json"},
"PUT non empty document"); "PUT non empty document");
o.jio.put({"_id": "http://100%.json", "title": "myPut1"}, o.f); o.jio.put({"_id": "http://100%.json", "title": "myPut1"}, o.f);
...@@ -150,17 +152,19 @@ test("Put", function(){ ...@@ -150,17 +152,19 @@ test("Put", function(){
//Put an existing document (update) //Put an existing document (update)
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200, {}, "HTML Response"] [200, {}, "HTML Response"]
); );
o.server.respondWith("PUT", o.server.respondWith(
"PUT",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200, {}, "HTML Response"] [200, {}, "HTML Response"]
); );
o.spy (o, "value", {"ok": true, "id": "http://100%.json"}, o.spy(o, "value", {"ok": true, "id": "http://100%.json"},
"PUT non empty document"); "PUT non empty document");
o.jio.put({"_id": "http://100%.json", "title": "myPut1"}, o.f); o.jio.put({"_id": "http://100%.json", "title": "myPut1"}, o.f);
...@@ -172,19 +176,19 @@ test("Put", function(){ ...@@ -172,19 +176,19 @@ test("Put", function(){
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
test ("PutAttachment", function(){ test("PutAttachment", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com" "url": "https://jiobucket.s3.amazonaws.com"
}); });
//PutAttachment without document ID (document ID is required) //PutAttachment without document ID (document ID is required)
...@@ -202,7 +206,8 @@ test ("PutAttachment", function(){ ...@@ -202,7 +206,8 @@ test ("PutAttachment", function(){
//PutAttachment without underlying document (document is required) //PutAttachment without underlying document (document is required)
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[404, {}, "HTML Response"] [404, {}, "HTML Response"]
); );
...@@ -219,18 +224,26 @@ test ("PutAttachment", function(){ ...@@ -219,18 +224,26 @@ test ("PutAttachment", function(){
//PutAttachment //PutAttachment
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200,{"Content-Type": "text/plain"},'{"_id":"http://100%.json","title":"Hi There!"}'] [
200,
{"Content-Type": "text/plain"},
'{"_id":"http://100%.json","title":"Hi There!"}'
]
); );
o.server.respondWith("PUT", o.server.respondWith(
"PUT",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200, {}, "HTML Response"] [200, {}, "HTML Response"]
); );
o.server.respondWith("PUT", o.server.respondWith(
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.body_.html", "PUT",
"http://s3.amazonaws.com/jiobucket" +
"/http:%252F%252F100%2525_.json.body_.html",
[200, {}, "HTML Response"] [200, {}, "HTML Response"]
); );
...@@ -254,25 +267,25 @@ test ("PutAttachment", function(){ ...@@ -254,25 +267,25 @@ test ("PutAttachment", function(){
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
/* /*
Get non existing document Get non existing document
Get non existing attachment Get non existing attachment
Get document Get document
Get non existing attachment (doc exists) Get non existing attachment (doc exists)
Get attachment Get attachment
*/ */
test("Get", function(){ test("Get", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com" "url": "https://jiobucket.s3.amazonaws.com"
}); });
//Get non existing document //Get non existing document
...@@ -282,9 +295,9 @@ test("Get", function(){ ...@@ -282,9 +295,9 @@ test("Get", function(){
[404, {}, "HTML Response"] [404, {}, "HTML Response"]
); );
o.spy(o, "status", 404, "Get non existing document" ); o.spy(o, "status", 404, "Get non existing document");
o.jio.get("doc", {"max_retry":1}, o.f); o.jio.get("doc", {"max_retry": 1}, o.f);
o.clock.tick(5000); o.clock.tick(5000);
o.server.respond(); o.server.respond();
...@@ -293,14 +306,20 @@ test("Get", function(){ ...@@ -293,14 +306,20 @@ test("Get", function(){
//Get document //Get document
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200,{"Content-Type": "text/plain"},'{"_id":"http://100%.json","title":"Hi There!"}'] [
200,
{"Content-Type": "text/plain"},
'{"_id":"http://100%.json","title":"Hi There!"}'
]
); );
o.spy(o, "value", {"_id":"http://100%.json","title":"Hi There!"}, "Get document" ) o.spy(o, "value", {"_id": "http://100%.json", "title": "Hi There!"},
o.jio.get({"_id":"http://100%.json"}, {"max_retry":1}, o.f); "Get document");
o.jio.get({"_id": "http://100%.json"}, {"max_retry": 1}, o.f);
o.clock.tick(5000); o.clock.tick(5000);
o.server.respond(); o.server.respond();
...@@ -308,26 +327,28 @@ test("Get", function(){ ...@@ -308,26 +327,28 @@ test("Get", function(){
o.server.restore(); o.server.restore();
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
test("GetAttachment", function(){ test("GetAttachment", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com" "url": "https://jiobucket.s3.amazonaws.com"
}); });
//Get non existing attachment //Get non existing attachment
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.body_.html", "GET",
"http://s3.amazonaws.com/jiobucket" +
"/http:%252F%252F100%2525_.json.body_.html",
[404, {}, "HTML Response"] [404, {}, "HTML Response"]
); );
o.spy(o, "status", 404, "Get non existing attachment" ); o.spy(o, "status", 404, "Get non existing attachment");
o.jio.getAttachment({ o.jio.getAttachment({
"_id": "http://100%.json", "_id": "http://100%.json",
...@@ -341,8 +362,10 @@ test("GetAttachment", function(){ ...@@ -341,8 +362,10 @@ test("GetAttachment", function(){
//Get attachment //Get attachment
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.body_.html", "GET",
"http://s3.amazonaws.com/jiobucket" +
"/http:%252F%252F100%2525_.json.body_.html",
[200, {"Content-Type": "text/plain"}, "My Attachment Content"] [200, {"Content-Type": "text/plain"}, "My Attachment Content"]
); );
...@@ -359,40 +382,41 @@ test("GetAttachment", function(){ ...@@ -359,40 +382,41 @@ test("GetAttachment", function(){
o.server.restore(); o.server.restore();
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
//begins the remove tests //begins the remove tests
/* /*
Remove inexistent document Remove inexistent document
Remove inexistent document/attachment Remove inexistent document/attachment
Remove document Remove document
Check index file Check index file
Check if document has been removed Check if document has been removed
Remove one of multiple attachment Remove one of multiple attachment
Check index file Check index file
Remove one document and attachment together Remove one document and attachment together
Check index file Check index file
Check if attachment has been removed Check if attachment has been removed
Check if document has been removed Check if document has been removed
*/ */
test ("Remove", function(){ test("Remove", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com/" "url": "https://jiobucket.s3.amazonaws.com/"
}); });
//Remove non-existing document //Remove non-existing document
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("DELETE", o.server.respondWith(
"DELETE",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[404, {}, "HTML RESPONSE"] [404, {}, "HTML RESPONSE"]
); );
...@@ -405,12 +429,14 @@ test ("Remove", function(){ ...@@ -405,12 +429,14 @@ test ("Remove", function(){
//Remove document //Remove document
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("DELETE", o.server.respondWith(
"DELETE",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200, {"Content-Type": "text/plain"}, "My Attachment Content"] [200, {"Content-Type": "text/plain"}, "My Attachment Content"]
); );
o.spy(o, "value", {"ok":true, "id":"http://100%.json"}, "Remove document"); o.spy(o, "value", {"ok": true, "id": "http://100%.json"},
"Remove document");
o.jio.remove({"_id": "http://100%.json"}, o.f); o.jio.remove({"_id": "http://100%.json"}, o.f);
o.clock.tick(5000); o.clock.tick(5000);
o.server.respond(); o.server.respond();
...@@ -420,7 +446,8 @@ test ("Remove", function(){ ...@@ -420,7 +446,8 @@ test ("Remove", function(){
//Remove document with multiple attachments //Remove document with multiple attachments
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[ [
200, 200,
...@@ -442,17 +469,21 @@ test ("Remove", function(){ ...@@ -442,17 +469,21 @@ test ("Remove", function(){
] ]
); );
o.server.respondWith("DELETE", o.server.respondWith(
"DELETE",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200, {"Content-Type": "text/plain"}, "<h1>Deleted</h1>"] [200, {"Content-Type": "text/plain"}, "<h1>Deleted</h1>"]
); );
o.server.respondWith("DELETE", o.server.respondWith(
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.body_.html", "DELETE",
"http://s3.amazonaws.com/jiobucket" +
"/http:%252F%252F100%2525_.json.body_.html",
[200, {"Content-Type": "text/plain"}, "<h1>Deleted</h1>"] [200, {"Content-Type": "text/plain"}, "<h1>Deleted</h1>"]
); );
o.server.respondWith("DELETE", o.server.respondWith(
"DELETE",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.other", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.other",
[200, {"Content-Type": "text/plain"}, "<h1>Deleted</h1>"] [200, {"Content-Type": "text/plain"}, "<h1>Deleted</h1>"]
); );
...@@ -466,25 +497,27 @@ test ("Remove", function(){ ...@@ -466,25 +497,27 @@ test ("Remove", function(){
o.server.restore(); o.server.restore();
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
test ("RemoveAttachment", function(){ test("RemoveAttachment", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com/" "url": "https://jiobucket.s3.amazonaws.com/"
}); });
//Remove non-existing attachment //Remove non-existing attachment
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("DELETE", o.server.respondWith(
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.body_.html", "DELETE",
"http://s3.amazonaws.com/jiobucket" +
"/http:%252F%252F100%2525_.json.body_.html",
[404, {}, "HTML RESPONSE"] [404, {}, "HTML RESPONSE"]
); );
...@@ -500,18 +533,30 @@ test ("RemoveAttachment", function(){ ...@@ -500,18 +533,30 @@ test ("RemoveAttachment", function(){
//Remove attachment //Remove attachment
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200,{"Content-Type": "text/plain"},'{"_id":"http://100%.json","title":"Hi There!"}'] [
200,
{"Content-Type": "text/plain"},
'{"_id":"http://100%.json","title":"Hi There!"}'
]
); );
o.server.respondWith("PUT", o.server.respondWith(
"PUT",
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json", "http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json",
[200,{"Content-Type": "text/plain"},'{"_id":"http://100%.json","title":"Hi There!"}'] [
200,
{"Content-Type": "text/plain"},
'{"_id":"http://100%.json","title":"Hi There!"}'
]
); );
o.server.respondWith("DELETE", o.server.respondWith(
"http://s3.amazonaws.com/jiobucket/http:%252F%252F100%2525_.json.body_.html", "DELETE",
"http://s3.amazonaws.com/jiobucket" +
"/http:%252F%252F100%2525_.json.body_.html",
[200, {"Content-Type": "text/plain"}, "My Attachment Content"] [200, {"Content-Type": "text/plain"}, "My Attachment Content"]
); );
...@@ -532,27 +577,47 @@ test ("RemoveAttachment", function(){ ...@@ -532,27 +577,47 @@ test ("RemoveAttachment", function(){
o.server.restore(); o.server.restore();
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
test ("AllDocs", function(){ test("AllDocs", function () {
var o = generateTools(this); var o = generateTools(this);
o.jio = jIO.newJio({ o.jio = jIO.newJio({
"type":"s3", "type": "s3",
"AWSIdentifier":"dontcare", "AWSIdentifier": "dontcare",
"password":"dontcare", "password": "dontcare",
"server":"jiobucket", "server": "jiobucket",
"url":"https://jiobucket.s3.amazonaws.com/" "url": "https://jiobucket.s3.amazonaws.com/"
}); });
//allDocs without option //allDocs without option
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/", "http://s3.amazonaws.com/jiobucket/",
[204, {}, '<?xml version="1.0" encoding="UTF-8"?><ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>jiobucket</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>documentONE</Key><LastModified>2013-05-03T15:32:01.000Z</LastModified><ETag>&quot;8a65389818768e1f5e6530a949233581&quot;</ETag><Size>163</Size><Owner><ID>5d09e586ab92acad85e9d053f769cce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jonathan.rivalan</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents><Contents><Key>documentONE.1st_Attachment_manual</Key><LastModified>2013-05-03T15:32:02.000Z</LastModified><ETag>&quot;f391dec65366d2b470406bc7b9595dea&quot;</ETag><Size>35</Size><Owner><ID>5d09e586ab92acad85e9d053f769cce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jonathan.rivalan</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>'] [
204,
{},
'<?xml version="1.0" encoding="UTF-8"?><ListBucketResult xml' +
'ns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>jiobucke' +
't</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</Ma' +
'xKeys><IsTruncated>false</IsTruncated><Contents><Key>docume' +
'ntONE</Key><LastModified>2013-05-03T15:32:01.000Z</LastModi' +
'fied><ETag>&quot;8a65389818768e1f5e6530a949233581&quot;</ET' +
'ag><Size>163</Size><Owner><ID>5d09e586ab92acad85e9d053f769c' +
'ce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jonath' +
'an.rivalan</DisplayName></Owner><StorageClass>STANDARD</Sto' +
'rageClass></Contents><Contents><Key>documentONE.1st_Attachm' +
'ent_manual</Key><LastModified>2013-05-03T15:32:02.000Z</Las' +
'tModified><ETag>&quot;f391dec65366d2b470406bc7b9595dea&quot' +
';</ETag><Size>35</Size><Owner><ID>5d09e586ab92acad85e9d053f' +
'769cce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jo' +
'nathan.rivalan</DisplayName></Owner><StorageClass>STANDARD<' +
'/StorageClass></Contents></ListBucketResult>'
]
); );
o.spy(o, "jobstatus", "done", "AllDocs without include docs"); o.spy(o, "jobstatus", "done", "AllDocs without include docs");
...@@ -565,12 +630,33 @@ test ("AllDocs", function(){ ...@@ -565,12 +630,33 @@ test ("AllDocs", function(){
//allDocs with the include docs option //allDocs with the include docs option
o.server = sinon.fakeServer.create(); o.server = sinon.fakeServer.create();
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://s3.amazonaws.com/jiobucket/", "http://s3.amazonaws.com/jiobucket/",
[204, {}, '<?xml version="1.0" encoding="UTF-8"?><ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>jiobucket</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>documentONE</Key><LastModified>2013-05-03T15:32:01.000Z</LastModified><ETag>&quot;8a65389818768e1f5e6530a949233581&quot;</ETag><Size>163</Size><Owner><ID>5d09e586ab92acad85e9d053f769cce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jonathan.rivalan</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents><Contents><Key>documentONE.1st_Attachment_manual</Key><LastModified>2013-05-03T15:32:02.000Z</LastModified><ETag>&quot;f391dec65366d2b470406bc7b9595dea&quot;</ETag><Size>35</Size><Owner><ID>5d09e586ab92acad85e9d053f769cce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jonathan.rivalan</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>'] [
204,
{},
'<?xml version="1.0" encoding="UTF-8"?><ListBucketResult xml' +
'ns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>jiobucke' +
't</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</Ma' +
'xKeys><IsTruncated>false</IsTruncated><Contents><Key>docume' +
'ntONE</Key><LastModified>2013-05-03T15:32:01.000Z</LastModi' +
'fied><ETag>&quot;8a65389818768e1f5e6530a949233581&quot;</ET' +
'ag><Size>163</Size><Owner><ID>5d09e586ab92acad85e9d053f769c' +
'ce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jonath' +
'an.rivalan</DisplayName></Owner><StorageClass>STANDARD</Sto' +
'rageClass></Contents><Contents><Key>documentONE.1st_Attachm' +
'ent_manual</Key><LastModified>2013-05-03T15:32:02.000Z</Las' +
'tModified><ETag>&quot;f391dec65366d2b470406bc7b9595dea&quot' +
';</ETag><Size>35</Size><Owner><ID>5d09e586ab92acad85e9d053f' +
'769cce65f82178e218d9ac9b0473f3ce7f89606</ID><DisplayName>jo' +
'nathan.rivalan</DisplayName></Owner><StorageClass>STANDARD<' +
'/StorageClass></Contents></ListBucketResult>'
]
); );
o.server.respondWith("GET", o.server.respondWith(
"GET",
"http://jiobucket.s3.amazonaws.com/documentONE", "http://jiobucket.s3.amazonaws.com/documentONE",
[ [
200, 200,
...@@ -595,7 +681,7 @@ test ("AllDocs", function(){ ...@@ -595,7 +681,7 @@ test ("AllDocs", function(){
console.log(o); console.log(o);
o.spy(o, "jobstatus", "done", "AllDocs with include docs"); o.spy(o, "jobstatus", "done", "AllDocs with include docs");
o.jio.allDocs({"include_docs": true},o.f); o.jio.allDocs({"include_docs": true}, o.f);
console.log(o.f); console.log(o.f);
o.clock.tick(5000); o.clock.tick(5000);
o.server.respond(); o.server.respond();
...@@ -603,6 +689,6 @@ test ("AllDocs", function(){ ...@@ -603,6 +689,6 @@ test ("AllDocs", function(){
o.server.restore(); o.server.restore();
util.closeAndcleanUpJio(o.jio); util.closeAndcleanUpJio(o.jio);
}); });
})); }));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment