Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge branch 'remove-e4x-tests'
* remove-e4x-tests:
  remove E4X tests
  • Loading branch information
janl committed Oct 7, 2013
2 parents c861f2d + fca376c commit 68f033b75a72a5868fd20fd806a6819ab7b0bec7
Showing 5 changed files with 4 additions and 135 deletions.
@@ -110,6 +110,5 @@ loadTest("view_offsets.js");
loadTest("view_pagination.js");
loadTest("view_sandboxing.js");
loadTest("view_update_seq.js");
loadTest("view_xml.js");
// keep sorted

@@ -90,20 +90,6 @@ couchTests.list_views = function(debug) {
// tail
return '</ul>';
});

provides("xml", function() {
send('<feed xmlns="http://www.w3.org/2005/Atom">'
+'<title>Test XML Feed</title>');

while (row = getRow()) {
var entry = new XML('<entry/>');
entry.id = row.id;
entry.title = row.key;
entry.content = row.value;
send(entry);
}
return "</feed>";
});
}),
qsParams: stringFun(function(head, req) {
return toJSON(req.query) + "\n";
@@ -413,21 +399,11 @@ couchTests.list_views = function(debug) {
T(xhr.responseText.match(/HTML/));
T(xhr.responseText.match(/Value/));

// now with xml
xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/acceptSwitch/basicView", {
headers: {
"Accept": 'application/xml'
}
});
T(xhr.getResponseHeader("Content-Type") == "application/xml");
T(xhr.responseText.match(/XML/));
T(xhr.responseText.match(/entry/));

// Test we can run lists and views from separate docs.
T(db.save(viewOnlyDesignDoc).ok);
var url = "/test_suite_db/_design/lists/_list/simpleForm/views/basicView" +
"?startkey=-3";
xhr = CouchDB.request("GET", url);
xhr = CouchDB.request("GET", url);
T(xhr.status == 200, "multiple design docs.");
T(!(/Key: -4/.test(xhr.responseText)));
T(/FirstKey: -3/.test(xhr.responseText));
@@ -70,14 +70,6 @@ couchTests.show_documents = function(debug) {
"fail" : stringFun(function(doc, req) {
return doc._id;
}),
"xml-type" : stringFun(function(doc, req) {
return {
"headers" : {
"Content-Type" : "application/xml"
},
"body" : new XML('<xml><node foo="bar"/></xml>').toXMLString()
}
}),
"no-set-etag" : stringFun(function(doc, req) {
return {
headers : {
@@ -159,16 +151,6 @@ couchTests.show_documents = function(debug) {
return "Ha ha, you said \"" + doc.word + "\".";
});

provides("xml", function() {
var xml = new XML('<xml><node/></xml>');
// Becase Safari can't stand to see that dastardly
// E4X outside of a string. Outside of tests you
// can just use E4X literals.
eval('xml.node.@foo = doc.word');
log('xml: '+xml.toSource());
return xml.toXMLString();
});

provides("foo", function() {
return "foofoo";
});
@@ -253,11 +235,6 @@ couchTests.show_documents = function(debug) {
T(equals(resp.path[5], docid));
T(equals(resp.info.db_name, "test_suite_db"));

// returning a content-type
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/xml-type/"+docid);
T("application/xml" == xhr.getResponseHeader("Content-Type"));
T("Accept" == xhr.getResponseHeader("Vary"));

// accept header switching
// different mime has different etag
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/accept-switch/"+docid, {
@@ -349,16 +326,6 @@ couchTests.show_documents = function(debug) {
T(/text\/html/.test(ct))
T(xhr.responseText == "Ha ha, you said \"plankton\".");

// now with xml
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/provides/"+docid, {
headers: {
"Accept": 'application/xml'
}
});
T(xhr.getResponseHeader("Content-Type") == "application/xml");
T(xhr.responseText.match(/node/));
T(xhr.responseText.match(/plankton/));

// registering types works
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/provides/"+docid, {
headers: {
@@ -378,15 +345,6 @@ couchTests.show_documents = function(debug) {
T(rs.error == "not_acceptable")


// should fallback on the first one
xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/provides/"+docid, {
headers: {
"Accept": 'application/x-foo, application/xml'
}
});
var ct = xhr.getResponseHeader("Content-Type");
T(/application\/xml/.test(ct));

// test inclusion of conflict state
var doc1 = {_id:"foo", a:1};
var doc2 = {_id:"foo", a:2};
@@ -33,8 +33,8 @@ couchTests.update_documents = function(debug) {
// and returns an HTML response to the client.
"<p>New World</p>"];
};
//
return [null, "<p>Empty World</p>"];
//
return [null, "<p>Empty World</p>"];
};
// we can update the document inline
doc.world = "hello";
@@ -66,20 +66,6 @@ couchTests.update_documents = function(debug) {
"error" : stringFun(function(doc, req) {
superFail.badCrash;
}),
"xml" : stringFun(function(doc, req) {
var xml = new XML('<xml></xml>');
xml.title = doc.title;
var posted_xml = new XML(req.body);
doc.via_xml = posted_xml.foo.toString();
var resp = {
"headers" : {
"Content-Type" : "application/xml"
},
"body" : xml.toXMLString()
};

return [doc, resp];
}),
"get-uuid" : stringFun(function(doc, req) {
return [null, req.uuid];
}),
@@ -156,7 +142,7 @@ couchTests.update_documents = function(debug) {
xhr = CouchDB.request("GET", "/test_suite_db/nonExistingDoc");
T(xhr.status == 200);

// in place update
// in place update
xhr = CouchDB.request("PUT", "/test_suite_db/_design/update/_update/in-place/"+docid+'?field=title&value=test');
T(xhr.status == 201);
T(xhr.responseText == "set title to test");
@@ -195,17 +181,6 @@ couchTests.update_documents = function(debug) {

T(doc.counter == 2);

// parse xml
xhr = CouchDB.request("PUT", "/test_suite_db/_design/update/_update/xml/"+docid, {
headers : {"X-Couch-Full-Commit":"true"},
"body" : '<xml><foo>bar</foo></xml>'
});
T(xhr.status == 201);
T(xhr.responseText == "<xml>\n <title>test</title>\n</xml>");

doc = db.open(docid);
T(doc.via_xml == "bar");

// Server provides UUID when POSTing without an ID in the URL
xhr = CouchDB.request("POST", "/test_suite_db/_design/update/_update/get-uuid/");
T(xhr.status == 200);

This file was deleted.

0 comments on commit 68f033b

Please sign in to comment.