You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2009/07/18 00:40:50 UTC

svn commit: r795258 - in /couchdb/trunk/test/etap: 030-doc-from-json.t 031-doc-to-json.t

Author: kocolosk
Date: Fri Jul 17 22:40:49 2009
New Revision: 795258

URL: http://svn.apache.org/viewvc?rev=795258&view=rev
Log:
update etap tests for new attachment format.

031 #11 still fails because length is undefined in CouchDB's response.

Modified:
    couchdb/trunk/test/etap/030-doc-from-json.t
    couchdb/trunk/test/etap/031-doc-to-json.t

Modified: couchdb/trunk/test/etap/030-doc-from-json.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/030-doc-from-json.t?rev=795258&r1=795257&r2=795258&view=diff
==============================================================================
--- couchdb/trunk/test/etap/030-doc-from-json.t (original)
+++ couchdb/trunk/test/etap/030-doc-from-json.t Fri Jul 17 22:40:49 2009
@@ -16,7 +16,8 @@
 
 %% XXX: Figure out how to -include("couch_db.hrl")
 -record(doc, {id= <<"">>, revs={0, []}, body={[]},
-            attachments=[], deleted=false, meta=[]}).
+            atts=[], deleted=false, meta=[]}).
+-record(att, {name, type, len, md5= <<>>, revpos=0, data}).
 
 main(_) ->
     code:add_pathz("src/couchdb"),
@@ -79,11 +80,19 @@
                     {<<"content_type">>, <<"application/pgp-signature">>}
                 ]}}
             ]}}]},
-            #doc{attachments=[
-                {<<"my_attachment.fu">>,
-                    {stub, <<"application/awesome">>, 45}},
-                {<<"noahs_private_key.gpg">>,
-                    {<<"application/pgp-signature">>, <<"I have a pet fish!">>}}
+            #doc{atts=[
+                #att{
+                    name = <<"my_attachment.fu">>,
+                    data = stub,
+                    type = <<"application/awesome">>,
+                    len = 45
+                },
+                #att{
+                    name = <<"noahs_private_key.gpg">>,
+                    data = <<"I have a pet fish!">>,
+                    type = <<"application/pgp-signature">>,
+                    len = 18
+                }
             ]},
             "Attachments are parsed correctly."
         },

Modified: couchdb/trunk/test/etap/031-doc-to-json.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/031-doc-to-json.t?rev=795258&r1=795257&r2=795258&view=diff
==============================================================================
--- couchdb/trunk/test/etap/031-doc-to-json.t (original)
+++ couchdb/trunk/test/etap/031-doc-to-json.t Fri Jul 17 22:40:49 2009
@@ -16,7 +16,8 @@
 
 %% XXX: Figure out how to -include("couch_db.hrl")
 -record(doc, {id= <<"">>, revs={0, []}, body={[]},
-            attachments=[], deleted=false, meta=[]}).
+            atts=[], deleted=false, meta=[]}).
+-record(att, {name, type, len, md5= <<>>, revpos=0, data}).
 
 main(_) ->
     code:add_pathz("src/couchdb"),
@@ -109,9 +110,18 @@
             "_deleted_conflicsts is added as an array of strings."
         },
         {
-            #doc{attachments=[
-                {<<"big.xml">>, {<<"xml/sucks">>, {fun() -> ok end, 400}}},
-                {<<"fast.json">>, {<<"json/ftw">>, <<"{\"so\": \"there!\"}">>}}
+            #doc{atts=[
+                #att{
+                    name = <<"big.xml">>, 
+                    type = <<"xml/sucks">>, 
+                    data = fun() -> ok end, 
+                    len = 400
+                },
+                #att{
+                    name = <<"fast.json">>, 
+                    type = <<"json/ftw">>, 
+                    data = <<"{\"so\": \"there!\"}">>
+                }
             ]},
             {[
                 {<<"_id">>, <<>>},
@@ -119,12 +129,14 @@
                     {<<"big.xml">>, {[
                         {<<"stub">>, true},
                         {<<"content_type">>, <<"xml/sucks">>},
-                        {<<"length">>, 400}
+                        {<<"length">>, 400},
+                        {<<"revpos">>, 0}
                     ]}},
                     {<<"fast.json">>, {[
                         {<<"stub">>, true},
                         {<<"content_type">>, <<"json/ftw">>},
-                        {<<"length">>, 16}
+                        {<<"length">>, 16},
+                        {<<"revpos">>, 0}
                     ]}}
                 ]}}
             ]},
@@ -132,20 +144,30 @@
         },
         {
             [attachments],
-            #doc{attachments=[
-                {<<"stuff.txt">>,
-                    {<<"text/plain">>, {fun() -> <<"diet pepsi">> end, 10}}},
-                {<<"food.now">>, {<<"application/food">>, <<"sammich">>}}
+            #doc{atts=[
+                #att{
+                    name = <<"stuff.txt">>,
+                    type = <<"text/plain">>,
+                    data = fun() -> <<"diet pepsi">> end,
+                    len = 10
+                },
+                #att{
+                    name = <<"food.now">>,
+                    type = <<"application/food">>,
+                    data = <<"sammich">>
+                }
             ]},
             {[
                 {<<"_id">>, <<>>},
                 {<<"_attachments">>, {[
                     {<<"stuff.txt">>, {[
                         {<<"content_type">>, <<"text/plain">>},
+                        {<<"revpos">>, 0},
                         {<<"data">>, <<"ZGlldCBwZXBzaQ==">>}
                     ]}},
                     {<<"food.now">>, {[
                         {<<"content_type">>, <<"application/food">>},
+                        {<<"revpos">>, 0},
                         {<<"data">>, <<"c2FtbWljaA==">>}
                     ]}}
                 ]}}