Commit 91ddd1e8 authored by Tristan Cavelier's avatar Tristan Cavelier

xwikistorage tests live tests removed

Live tests should be on a seperate qunit page
parent 0f91cf2b
...@@ -318,110 +318,4 @@ ...@@ -318,110 +318,4 @@
return ret; return ret;
}; };
if (window.location.href.match(/xwiki\/bin\/view/)) (function() {
// This test will only be run if we are inside of a live XWiki instance.
test ("XWiki Live Server setup", function () {
var o = setUp(this);
o.jio.stop();
this.sandbox.restore();
o.server.restore();
o.jio.start();
QUnit.stop();
nThen(function(waitFor) {
// Remove the document if it exists.
o.jio.remove({"_id": "one.json"}, waitFor());
}).nThen(function(waitFor) {
// post a new document
o.spy(o, "value", {"id": "one.json", "ok": true}, "Live post document");
o.jio.post({"_id": "one.json", "title": "hello"}, waitFor(o.f));
}).nThen(function(waitFor) {
o.jio.get("one.json", waitFor(function(err, ret) {
ok(!err);
ok(ret._id == "one.json");
ok(ret.title == "hello");
}));
}).nThen(function(waitFor) {
// modify document
o.spy(o, "value", {"id": "one.json", "ok": true}, "Live modify document");
o.jio.put({"_id": "one.json", "title": "hello modified"}, waitFor(o.f));
}).nThen(function(waitFor) {
o.jio.get("one.json", waitFor(function(err, ret) {
ok(!err);
ok(ret.title == "hello modified");
}));
}).nThen(function(waitFor) {
// add attachment
o.spy(o, "value", {"id": "one.json/att.txt", "ok": true}, "Put attachment");
o.jio.putAttachment({
"_id": "one.json",
"_attachment": "att.txt",
"_mimetype": "text/plain",
"_data": "there2"
}, waitFor(o.f));
}).nThen(function(waitFor) {
// test allDocs
/*o.jio.allDocs({"include_docs":true},
function(s){console.log(s);},
function ( e ) {console.log(e);
}, o.f);*/
}).nThen(function(waitFor) {
// get Attachment
o.jio.getAttachment({"_id":"one.json", "_attachment":"att.txt"}, waitFor(function(err, ret) {
ok(!err);
ok(ret == "there2");
}));
}).nThen(function(waitFor) {
// remove Attachment
o.spy(o, "value", {"id": "one.json/att.txt", "ok": true}, "Remove attachment");
o.jio.removeAttachment({"_id":"one.json","_attachment":"att.txt"}, waitFor(o.f));
}).nThen(function(waitFor) {
// remove Document
o.spy(o, "value", {"id": "one.json", "ok": true}, "Remove document");
o.jio.remove("one.json", waitFor(o.f));
}).nThen(function(waitFor) {
//console.log("success");
}).orTimeout(function() {
//console.log("failed");
ok(0);
}, 15000).nThen(function() {
//console.log("complete");
o.jio.stop();
QUnit.start();
});
});
})(); // Live XWiki
})(); // xwiki
})); }));
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