couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [02/25] couch commit: updated refs/heads/master to 92598cd
Date Thu, 15 Oct 2015 16:35:36 GMT
Add doc:len_doc_to_multi_part_stream test


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

Branch: refs/heads/master
Commit: ad99a53864915804d54cdc7e8ebdfd74a9d0e34d
Parents: 0a2e312
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Fri Nov 28 15:05:50 2014 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Wed May 6 06:55:58 2015 -0700

----------------------------------------------------------------------
 test/couch_doc_tests.erl | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/ad99a538/test/couch_doc_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_doc_tests.erl b/test/couch_doc_tests.erl
index 1ccf2b8..853a3af 100644
--- a/test/couch_doc_tests.erl
+++ b/test/couch_doc_tests.erl
@@ -60,6 +60,19 @@ doc_to_multi_part_stream_test() ->
     ] = collected(),
     ok.
 
+len_doc_to_multi_part_stream_test() ->
+    Boundary = <<"simple_boundary">>,
+    JsonBytes = <<"{\n \"_id\": \"our document goes here\"\n}\n\n">>,
+    ContentType = <<"multipart/related; boundary=\"", Boundary/binary, "\"">>,
+    AttData = <<"Hello my important document">>,
+    AttLength = size(AttData),
+    Atts = [couch_att:new([
+       {name, <<"test">>}, {data, AttData}, {type, <<"text/plain">>},
+       {att_len, AttLength}, {disk_len, AttLength}])],
+    {ContentType, 258} = %% 258 is expected size of the document
+        couch_doc:len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, true),
+    ok.
+
 request(start) ->
     {ok, Doc} = file:read_file(?REQUEST_FIXTURE),
     {Doc, fun() -> request(stop) end};


Mime
View raw message