couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [22/48] couch commit: updated refs/heads/master to 7776921
Date Sat, 04 Apr 2015 23:29:17 GMT
Enable couch_doc_json_tests

COUCHDB-2547


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

Branch: refs/heads/master
Commit: b59b529e59c072939d2c327f86401ad2d30a5e98
Parents: 5331056
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Mon Feb 2 12:24:59 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Feb 10 11:04:24 2015 -0800

----------------------------------------------------------------------
 test/couch_doc_json_tests.erl | 108 ++++++++++++++++---------------------
 1 file changed, 47 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/b59b529e/test/couch_doc_json_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_doc_json_tests.erl b/test/couch_doc_json_tests.erl
index 20010ac..56587cd 100644
--- a/test/couch_doc_json_tests.erl
+++ b/test/couch_doc_json_tests.erl
@@ -16,21 +16,10 @@
 -include_lib("couch/include/couch_db.hrl").
 
 
--ifdef(run_broken_tests).
-
-setup() ->
-    {ok, Pid} = test_util:start_config(?CONFIG_CHAIN),
-    config:set("attachments", "compression_level", "0", false),
-    Pid.
-
-teardown(_) ->
-    test_util:stop_config().
-
-
 json_doc_test_() ->
     {
         setup,
-        fun setup/0, fun teardown/1,
+        fun() -> test_util:start(?MODULE) end, fun test_util:stop/1,
         [
             {
                 "Document from JSON",
@@ -93,22 +82,22 @@ from_json_success_cases() ->
                 ]}}
             ]}}]},
             #doc{atts = [
-                #att{
-                    name = <<"my_attachment.fu">>,
-                    data = stub,
-                    type = <<"application/awesome">>,
-                    att_len = 45,
-                    disk_len = 45,
-                    revpos = nil
-                },
-                #att{
-                    name = <<"noahs_private_key.gpg">>,
-                    data = <<"I have a pet fish!">>,
-                    type = <<"application/pgp-signature">>,
-                    att_len = 18,
-                    disk_len = 18,
-                    revpos = 0
-                }
+                couch_att:new([
+                    {name, <<"my_attachment.fu">>},
+                    {data, stub},
+                    {type, <<"application/awesome">>},
+                    {att_len, 45},
+                    {disk_len, 45},
+                    {revpos, undefined}
+                ]),
+                couch_att:new([
+                    {name, <<"noahs_private_key.gpg">>},
+                    {data, <<"I have a pet fish!">>},
+                    {type, <<"application/pgp-signature">>},
+                    {att_len, 18},
+                    {disk_len, 18},
+                    {revpos, 0}
+                ])
             ]},
             "Attachments are parsed correctly."
         },
@@ -312,22 +301,22 @@ to_json_success_cases() ->
         },
         {
             #doc{atts = [
-                #att{
-                    name = <<"big.xml">>,
-                    type = <<"xml/sucks">>,
-                    data = fun() -> ok end,
-                    revpos = 1,
-                    att_len = 400,
-                    disk_len = 400
-                },
-                #att{
-                    name = <<"fast.json">>,
-                    type = <<"json/ftw">>,
-                    data = <<"{\"so\": \"there!\"}">>,
-                    revpos = 1,
-                    att_len = 16,
-                    disk_len = 16
-                }
+                couch_att:new([
+                    {name, <<"big.xml">>},
+                    {type, <<"xml/sucks">>},
+                    {data, fun() -> ok end},
+                    {revpos, 1},
+                    {att_len, 400},
+                    {disk_len, 400}
+                ]),
+                couch_att:new([
+                    {name, <<"fast.json">>},
+                    {type, <<"json/ftw">>},
+                    {data, <<"{\"so\": \"there!\"}">>},
+                    {revpos, 1},
+                    {att_len, 16},
+                    {disk_len, 16}
+                ])
             ]},
             {[
                  {<<"_id">>, <<>>},
@@ -351,20 +340,20 @@ to_json_success_cases() ->
         {
             [attachments],
             #doc{atts = [
-                #att{
-                    name = <<"stuff.txt">>,
-                    type = <<"text/plain">>,
-                    data = fun() -> <<"diet pepsi">> end,
-                    revpos = 1,
-                    att_len = 10,
-                    disk_len = 10
-                },
-                #att{
-                    name = <<"food.now">>,
-                    type = <<"application/food">>,
-                    revpos = 1,
-                    data = <<"sammich">>
-                }
+                couch_att:new([
+                    {name, <<"stuff.txt">>},
+                    {type, <<"text/plain">>},
+                    {data, fun() -> <<"diet pepsi">> end},
+                    {revpos, 1},
+                    {att_len, 10},
+                    {disk_len, 10}
+                ]),
+                couch_att:new([
+                    {name, <<"food.now">>},
+                    {type, <<"application/food">>},
+                    {revpos, 1},
+                    {data, <<"sammich">>}
+                ])
             ]},
             {[
                 {<<"_id">>, <<>>},
@@ -391,6 +380,3 @@ to_json_success_cases() ->
         ({Options, Doc, EJson, Msg}) ->
             {Msg, ?_assertMatch(EJson, couch_doc:to_json_obj(Doc, Options))}
     end, Cases).
-
--endif.
-


Mime
View raw message