summaryrefslogtreecommitdiff
path: root/src/couch/test
diff options
context:
space:
mode:
authorjiangph <jiangph@cn.ibm.com>2018-12-13 14:34:47 +0800
committerjiangph <jiangph@cn.ibm.com>2019-01-05 09:53:21 +0800
commitc68863aec58642fc610ede62906609ba6c816a92 (patch)
treebd437af129f3a5c737496a742a842530fc7c4eb9 /src/couch/test
parentdc931567ae5141e24305baac6c3b4844929aa615 (diff)
downloadcouchdb-before_doc_update.tar.gz
Update before_doc_update/2 to before_doc_update/3before_doc_update
- Pass UpdateType to before_doc_update/3
Diffstat (limited to 'src/couch/test')
-rw-r--r--src/couch/test/couch_db_plugin_tests.erl17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/couch/test/couch_db_plugin_tests.erl b/src/couch/test/couch_db_plugin_tests.erl
index 52533fec2..93551adbc 100644
--- a/src/couch/test/couch_db_plugin_tests.erl
+++ b/src/couch/test/couch_db_plugin_tests.erl
@@ -14,7 +14,7 @@
-export([
validate_dbname/2,
- before_doc_update/2,
+ before_doc_update/3,
after_doc_read/2,
validate_docid/1,
check_is_admin/1,
@@ -58,9 +58,9 @@ validate_dbname({false, _Db}, _) -> {decided, false};
validate_dbname({fail, _Db}, _) -> throw(validate_dbname);
validate_dbname({pass, _Db}, _) -> no_decision.
-before_doc_update({fail, _Doc}, _Db) -> throw(before_doc_update);
-before_doc_update({true, Doc}, Db) -> [{true, [before_doc_update|Doc]}, Db];
-before_doc_update({false, Doc}, Db) -> [{false, Doc}, Db].
+before_doc_update({fail, _Doc}, _Db, interactive_edit) -> throw(before_doc_update);
+before_doc_update({true, Doc}, Db, interactive_edit) -> [{true, [before_doc_update|Doc]}, Db, interactive_edit];
+before_doc_update({false, Doc}, Db, interactive_edit) -> [{false, Doc}, Db, interactive_edit].
after_doc_read({fail, _Doc}, _Db) -> throw(after_doc_read);
after_doc_read({true, Doc}, Db) -> [{true, [after_doc_read|Doc]}, Db];
@@ -134,17 +134,20 @@ validate_dbname_pass() ->
before_doc_update_match() ->
?assertMatch(
{true, [before_doc_update, doc]},
- couch_db_plugin:before_doc_update(fake_db(), {true, [doc]})).
+ couch_db_plugin:before_doc_update(
+ fake_db(), {true, [doc]}, interactive_edit)).
before_doc_update_no_match() ->
?assertMatch(
{false, [doc]},
- couch_db_plugin:before_doc_update(fake_db(), {false, [doc]})).
+ couch_db_plugin:before_doc_update(
+ fake_db(), {false, [doc]}, interactive_edit)).
before_doc_update_throw() ->
?assertThrow(
before_doc_update,
- couch_db_plugin:before_doc_update(fake_db(), {fail, [doc]})).
+ couch_db_plugin:before_doc_update(
+ fake_db(), {fail, [doc]}, interactive_edit)).
after_doc_read_match() ->