couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [01/35] couchdb commit: updated refs/heads/2876-js-tests-merged to 6d9b2eb
Date Sat, 12 Dec 2015 16:01:22 GMT
Repository: couchdb
Updated Branches:
  refs/heads/2876-js-tests-merged [created] 6d9b2eb8f


wip


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8fc4ecce
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8fc4ecce
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8fc4ecce

Branch: refs/heads/2876-js-tests-merged
Commit: 8fc4eccea53bc55c98a74ec9f4bcec1d98e8bedf
Parents: 9543d82
Author: Jan Lehnardt <jan@apache.org>
Authored: Sat Jun 27 00:07:57 2015 +0200
Committer: Jan Lehnardt <jan@apache.org>
Committed: Sat Dec 12 15:23:25 2015 +0100

----------------------------------------------------------------------
 test/javascript/couch.js                  |  2 ++
 test/javascript/couch_test_runner.js      |  8 ++++++++
 test/javascript/tests/attachment_names.js | 18 +++++++++++-------
 test/javascript/tests/attachments.js      | 15 +++++++++++----
 4 files changed, 32 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/8fc4ecce/test/javascript/couch.js
----------------------------------------------------------------------
diff --git a/test/javascript/couch.js b/test/javascript/couch.js
index 02722a2..edcf393 100644
--- a/test/javascript/couch.js
+++ b/test/javascript/couch.js
@@ -423,6 +423,8 @@ CouchDB.request = function(method, uri, options) {
   options.headers["Accept"] = options.headers["Accept"] || options.headers["accept"] || "application/json";
   var req = CouchDB.newXhr();
   uri = CouchDB.proxyUrl(uri);
+  console.log(uri);
+  console.log(JSON.stringify(options, null, 2));
   req.open(method, uri, false);
   if (options.headers) {
     var headers = options.headers;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8fc4ecce/test/javascript/couch_test_runner.js
----------------------------------------------------------------------
diff --git a/test/javascript/couch_test_runner.js b/test/javascript/couch_test_runner.js
index efc4dc2..c8e5720 100644
--- a/test/javascript/couch_test_runner.js
+++ b/test/javascript/couch_test_runner.js
@@ -463,3 +463,11 @@ CouchDB.prepareUserDoc = function(user_doc, new_password) {
   }
   return user_doc;
 };
+
+function get_random_db_name() {
+  return "test_suite_db_"
+   + Math.random()
+    .toString(36)
+    .replace(/[^a-z]+/g, '')
+    .substr(0, 8);
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8fc4ecce/test/javascript/tests/attachment_names.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/attachment_names.js b/test/javascript/tests/attachment_names.js
index c9a5fcc..89ce3e9 100644
--- a/test/javascript/tests/attachment_names.js
+++ b/test/javascript/tests/attachment_names.js
@@ -11,8 +11,8 @@
 // the License.
 
 couchTests.attachment_names = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
+  var db_name = get_random_db_name();
+  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   db.createDb();
   if (debug) debugger;
 
@@ -29,7 +29,7 @@ couchTests.attachment_names = function(debug) {
   var save_response = db.save(goodDoc);
   T(save_response.ok);
 
-  var xhr = CouchDB.request("GET", "/test_suite_db/good_doc/Колян.txt");
+  var xhr = CouchDB.request("GET", "/" + db_name + "/good_doc/Колян.txt");
   T(xhr.responseText == "This is a base64 encoded text");
   T(xhr.getResponseHeader("Content-Type") == "application/octet-stream");
   TEquals("\"aEI7pOYCRBLTRQvvqYrrJQ==\"", xhr.getResponseHeader("Etag"));
@@ -37,7 +37,7 @@ couchTests.attachment_names = function(debug) {
   var binAttDoc = {
     _id: "bin_doc",
     _attachments:{
-      "foo\x80txt": {
+      "footxt": {
         content_type:"text/plain",
         data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
       }
@@ -53,7 +53,7 @@ couchTests.attachment_names = function(debug) {
   var bin_data = "JHAPDO*AU£PN ){(3u[d 93DQ9¡€])}    ææøo'∂ƒæ≤çæππ•¥∫¶®#†π¶®¥π€ª®˙π8np";
 
 
-  var xhr = (CouchDB.request("PUT", "/test_suite_db/bin_doc3/attachment\x80txt", {
+  var xhr = (CouchDB.request("PUT", "/" + db_name + "/bin_doc3/attachmenttxt", {
     headers:{"Content-Type":"text/plain;charset=utf-8"},
     body:bin_data
   }));
@@ -64,10 +64,14 @@ couchTests.attachment_names = function(debug) {
 
   // bulk docs
   var docs = { docs: [binAttDoc] };
-
-  var xhr = CouchDB.request("POST", "/test_suite_db/_bulk_docs", {
+  console.log(JSON.stringify(docs, null, 2));
+  var xhr = CouchDB.request("POST", "/" + db_name + "/_bulk_docs", {
     body: JSON.stringify(docs)
   });
+  console.log(JSON.stringify(xhr.status, null, 2));
+  console.log(JSON.stringify(xhr.responseText, null, 2));
+  console.log(JSON.stringify(xhr.headers, null, 2));
+  
 
   TEquals(201, xhr.status, "attachment_name: bulk docs");
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8fc4ecce/test/javascript/tests/attachments.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/attachments.js b/test/javascript/tests/attachments.js
index 2fa08ee..41a826a 100644
--- a/test/javascript/tests/attachments.js
+++ b/test/javascript/tests/attachments.js
@@ -214,8 +214,11 @@ couchTests.attachments= function(debug) {
 
 
   // test large attachments - COUCHDB-366
-  var lorem = CouchDB.request("GET", "/_utils/script/test/lorem.txt").responseText;
-
+  var lorem = CouchDB.request("GET", "/_utils/test/lorem.txt").responseText;
+  console.log('lorem');
+  console.log(lorem);
+  console.log('end lorem');
+  
   var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc5/lorem.txt", {
     headers:{"Content-Type":"text/plain;charset=utf-8"},
     body:lorem
@@ -228,9 +231,13 @@ couchTests.attachments= function(debug) {
   TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   // test large inline attachment too
-  var lorem_b64 = CouchDB.request("GET", "/_utils/script/test/lorem_b64.txt").responseText;
+  var lorem_b64 = CouchDB.request("GET", "/_utils/test/lorem_b64.txt");
+  console.log(JSON.stringify(lorem_b64, null, 2));
+  console.log(lorem_b64.status);
+  console.log(lorem_b64.responseText);
+  lorem_b64 = lorem_b64.responseText;
   var doc = db.open("bin_doc5", {attachments:true});
-  T(doc._attachments["lorem.txt"].data == lorem_b64);
+  TEquals(lorem_b64, doc._attachments["lorem.txt"].data, 'binary attachment data should match');
 
   // test etags for attachments.
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc5/lorem.txt");


Mime
View raw message