You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/01/04 18:06:48 UTC

[couchdb] 01/01: Add test coverage for replicator user_ctx parser

This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch rep-user-ctx-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 78d08e8894d8b62dc61d98becb0f2bfc63dc6c4b
Author: Jay Doane <ja...@apache.org>
AuthorDate: Wed Jan 4 10:06:33 2023 -0800

    Add test coverage for replicator user_ctx parser
    
    This adds a test to cover the case when a replication doc contains a
    user_ctx, and subsequently executes `get_json_value/3`.
    
    See: https://github.com/apache/couchdb/pull/4343
---
 src/couch_replicator/src/couch_replicator_parse.erl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/couch_replicator/src/couch_replicator_parse.erl b/src/couch_replicator/src/couch_replicator_parse.erl
index 8cad4d9a3..8fed8472c 100644
--- a/src/couch_replicator/src/couch_replicator_parse.erl
+++ b/src/couch_replicator/src/couch_replicator_parse.erl
@@ -583,6 +583,13 @@ check_convert_options_fail_test() ->
         convert_options([{<<"query_params">>, 42}])
     ).
 
+rep_user_ctx_test() ->
+    RepDoc = {[{<<"user_ctx">>, {[]} }]},
+    ?assertEqual(
+        #user_ctx{name = null, roles = [], handler = undefined},
+        rep_user_ctx(RepDoc)
+    ).
+
 local_replication_endpoint_error_test_() ->
     {
         foreach,