diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2009-07-17 22:40:49 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2009-07-17 22:40:49 +0000 |
commit | 57ab96ff2f67854429fef487c0e293e34663d4af (patch) | |
tree | ec5df6f9e64633137ebaefd364c5ae2bc4edbb34 /test | |
parent | 91bf33fdc69c2087707795b8822b0fa7617f8709 (diff) |
update etap tests for new attachment format.
031 #11 still fails because length is undefined in CouchDB's response.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795258 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rwxr-xr-x | test/etap/030-doc-from-json.t | 21 | ||||
-rwxr-xr-x | test/etap/031-doc-to-json.t | 42 |
2 files changed, 47 insertions, 16 deletions
diff --git a/test/etap/030-doc-from-json.t b/test/etap/030-doc-from-json.t index 2bfdfdc5..241aee40 100755 --- a/test/etap/030-doc-from-json.t +++ b/test/etap/030-doc-from-json.t @@ -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 @@ test_from_json_success() -> {<<"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." }, diff --git a/test/etap/031-doc-to-json.t b/test/etap/031-doc-to-json.t index 1bf49d6b..7d2ca065 100755 --- a/test/etap/031-doc-to-json.t +++ b/test/etap/031-doc-to-json.t @@ -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 @@ test_to_json_success() -> "_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 @@ test_to_json_success() -> {<<"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 @@ test_to_json_success() -> }, { [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==">>} ]}} ]}} |