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 2021/09/27 17:26:09 UTC

[couchdb] branch remove-redundant-csp-tests created (now 548964e)

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

jaydoane pushed a change to branch remove-redundant-csp-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 548964e  Remove unused variables and extra whitespace

This branch includes the following new commits:

     new 593539e  Remove redundant CSP tests
     new 548964e  Remove unused variables and extra whitespace

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[couchdb] 02/02: Remove unused variables and extra whitespace

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch remove-redundant-csp-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 548964e77874b04af86e5c16e27d4c4d1a0434f7
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon Sep 27 10:20:58 2021 -0700

    Remove unused variables and extra whitespace
---
 src/chttpd/test/eunit/chttpd_db_test.erl | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/chttpd/test/eunit/chttpd_db_test.erl b/src/chttpd/test/eunit/chttpd_db_test.erl
index d844aa5..6ae5ad0 100644
--- a/src/chttpd/test/eunit/chttpd_db_test.erl
+++ b/src/chttpd/test/eunit/chttpd_db_test.erl
@@ -259,7 +259,7 @@ should_return_correct_id_on_doc_copy(Url) ->
             [?CONTENT_JSON, ?AUTH, ?DESTHEADER1]),
         {ResultJson1} = ?JSON_DECODE(ResultBody1),
         Id1 = couch_util:get_value(<<"id">>, ResultJson1),
-        
+
         {_, _, _, ResultBody2} = test_request:copy(Url ++ "/testdoc/",
             [?CONTENT_JSON, ?AUTH, ?DESTHEADER2]),
         {ResultJson2} = ?JSON_DECODE(ResultBody2),
@@ -276,7 +276,7 @@ should_return_only_one_ok_on_doc_copy(Url) ->
        {_, _, _, ResultBody} = test_request:copy(Url ++ "/testdoc",
            [?CONTENT_JSON, ?AUTH, ?DESTHEADER1]),
        {ResultJson} = jiffy:decode(ResultBody),
-       NumOks = length(lists:filter(fun({Key, Value}) -> Key == <<"ok">> end, ResultJson)),
+       NumOks = length(lists:filter(fun({Key, _Value}) -> Key == <<"ok">> end, ResultJson)),
        [
            ?assertEqual(1, NumOks)
        ]
@@ -311,7 +311,6 @@ should_not_change_db_proper_after_rewriting_shardmap(_) ->
         TmpDb = ?tempdb(),
         Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
         Port = mochiweb_socket_server:get(chttpd, port),
-        AdmPort = mochiweb_socket_server:get(couch_httpd, port),
 
         BaseUrl = lists:concat(["http://", Addr, ":", Port, "/", ?b2l(TmpDb)]),
         Url = BaseUrl ++ "?partitioned=true&q=1",

[couchdb] 01/02: Remove redundant CSP tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch remove-redundant-csp-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 593539edc90e083abf8c8c1bca949ede6ed1b2fa
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon Sep 27 10:14:53 2021 -0700

    Remove redundant CSP tests
    
    These two tests exercise the same assertions as the individual
    `sandbox_doc_attachments` test case in chttpd_csp_tests.erl.
---
 src/chttpd/test/eunit/chttpd_db_test.erl | 45 --------------------------------
 1 file changed, 45 deletions(-)

diff --git a/src/chttpd/test/eunit/chttpd_db_test.erl b/src/chttpd/test/eunit/chttpd_db_test.erl
index 06ac147..d844aa5 100644
--- a/src/chttpd/test/eunit/chttpd_db_test.erl
+++ b/src/chttpd/test/eunit/chttpd_db_test.erl
@@ -69,8 +69,6 @@ all_test_() ->
                     fun should_return_404_for_delete_att_on_notadoc/1,
                     fun should_return_409_for_del_att_without_rev/1,
                     fun should_return_200_for_del_att_with_rev/1,
-                    fun should_send_csp_header_with_att/1,
-                    fun should_send_not_csp_header_with_att_when_no_config/1,
                     fun should_return_409_for_put_att_nonexistent_rev/1,
                     fun should_return_update_seq_when_set_on_all_docs/1,
                     fun should_not_return_update_seq_when_unset_on_all_docs/1,
@@ -211,49 +209,6 @@ should_return_200_for_del_att_with_rev(Url) ->
     end)}.
 
 
-should_send_csp_header_with_att(Url) ->
-  {timeout, ?TIMEOUT, ?_test(begin
-      {ok, RC, _, _} = test_request:put(
-          Url ++ "/testdoc5",
-          [?CONTENT_JSON, ?AUTH],
-          jiffy:encode(attachment_doc())
-      ),
-      ?assertEqual(201, RC),
-
-      {ok, _, Headers, _} = test_request:get(
-          Url ++ "/testdoc5/file.erl",
-          [?AUTH],
-          []
-      ),
-      CSPHeader = couch_util:get_value("Content-Security-Policy", Headers),
-      ?assertEqual("sandbox", CSPHeader)
-    end)}.
-
-
-should_send_not_csp_header_with_att_when_no_config(Url) ->
-  {timeout, ?TIMEOUT, ?_test(begin
-      {ok, RC, _, _} = test_request:put(
-          Url ++ "/testdoc6",
-          [?CONTENT_JSON, ?AUTH],
-          jiffy:encode(attachment_doc())
-      ),
-      ?assertEqual(201, RC),
-
-      config:set_boolean("csp", "attachments_enable", false, _Persist=false),
-
-      {ok, _, Headers, _} = test_request:get(
-          Url ++ "/testdoc6/file.erl",
-          [?AUTH],
-          []
-      ),
-      CSPHeader = couch_util:get_value("Content-Security-Policy", Headers),
-      ?assertEqual(undefined, CSPHeader),
-
-      config:delete("csp", "attachments_enable", _Persist=false)
-
-    end)}.
-
-
 should_return_409_for_put_att_nonexistent_rev(Url) ->
     {timeout, ?TIMEOUT, ?_test(begin
         {ok, RC, _Headers, RespBody} = test_request:put(