diff options
author | Jay Doane <jay.s.doane@gmail.com> | 2018-12-22 21:42:31 -0800 |
---|---|---|
committer | Jay Doane <jay.s.doane@gmail.com> | 2018-12-22 21:42:31 -0800 |
commit | c54bea33f9ad7d74548fab5e1c4d781d78fb22a3 (patch) | |
tree | 597828dd733fbbe7b05a8517b9be279c60b314b0 | |
parent | e97f0297234b03b9b4a9904c7403b703a2a9a735 (diff) | |
download | couchdb-c54bea33f9ad7d74548fab5e1c4d781d78fb22a3.tar.gz |
Fix elixir test formatting
Prior to this, `make elixir` was failing with these errors:
** (Mix) mix format failed due to --check-formatted.
The following files were not formatted:
* test/security_validation_test.exs
* test/rewrite_test.exs
* test/cluster_with_quorum_test.exs
* test/cluster_without_quorum_test.exs
* test/all_docs_test.exs
-rw-r--r-- | test/elixir/test/all_docs_test.exs | 31 | ||||
-rw-r--r-- | test/elixir/test/cluster_with_quorum_test.exs | 18 | ||||
-rw-r--r-- | test/elixir/test/cluster_without_quorum_test.exs | 18 | ||||
-rw-r--r-- | test/elixir/test/rewrite_test.exs | 6 | ||||
-rw-r--r-- | test/elixir/test/security_validation_test.exs | 6 |
5 files changed, 52 insertions, 27 deletions
diff --git a/test/elixir/test/all_docs_test.exs b/test/elixir/test/all_docs_test.exs index 21dcb616b..1869277fe 100644 --- a/test/elixir/test/all_docs_test.exs +++ b/test/elixir/test/all_docs_test.exs @@ -46,7 +46,8 @@ defmodule AllDocsTest do # Confirm that queries may assume raw collation resp = - Couch.get("/#{db_name}/_all_docs", + Couch.get( + "/#{db_name}/_all_docs", query: %{ :startkey => "\"org.couchdb.user:\"", :endkey => "\"org.couchdb.user;\"" @@ -99,7 +100,8 @@ defmodule AllDocsTest do # Test _all_docs with keys rows = - Couch.post("/#{db_name}/_all_docs", + Couch.post( + "/#{db_name}/_all_docs", query: %{:include_docs => true}, body: %{:keys => ["1"]} ).body["rows"] @@ -124,18 +126,23 @@ defmodule AllDocsTest do :value => "Z" } - assert Couch.put("/#{db_name}/3", query: %{:new_edits => false}, body: conflicted_doc1).body[ - "ok" - ] + assert Couch.put( + "/#{db_name}/3", + query: %{:new_edits => false}, + body: conflicted_doc1 + ).body["ok"] - assert Couch.put("/#{db_name}/3", query: %{:new_edits => false}, body: conflicted_doc2).body[ - "ok" - ] + assert Couch.put( + "/#{db_name}/3", + query: %{:new_edits => false}, + body: conflicted_doc2 + ).body["ok"] win_rev = Couch.get("/#{db_name}/3").body changes = - Couch.get("/#{db_name}/_changes", + Couch.get( + "/#{db_name}/_changes", query: %{:include_docs => true, :conflicts => true, :style => "all_docs"} ).body["results"] @@ -147,7 +154,8 @@ defmodule AllDocsTest do assert length(doc3["doc"]["_conflicts"]) == 2 rows = - Couch.get("/#{db_name}/_all_docs", + Couch.get( + "/#{db_name}/_all_docs", query: %{:include_docs => true, :conflicts => true} ).body["rows"] @@ -166,7 +174,8 @@ defmodule AllDocsTest do assert Couch.post("/#{db_name}", body: %{:_id => "a", :foo => "a"}).body["ok"] rows = - Couch.get("/#{db_name}/_all_docs", + Couch.get( + "/#{db_name}/_all_docs", query: %{:startkey => "\"Z\"", :endkey => "\"Z\""} ).body["rows"] diff --git a/test/elixir/test/cluster_with_quorum_test.exs b/test/elixir/test/cluster_with_quorum_test.exs index 76fc9b449..d07b18fea 100644 --- a/test/elixir/test/cluster_with_quorum_test.exs +++ b/test/elixir/test/cluster_with_quorum_test.exs @@ -51,7 +51,8 @@ defmodule WithQuorumTest do Couch.put("/#{db_name}") resp = - Couch.post("/#{context[:db_name]}", + Couch.post( + "/#{context[:db_name]}", query: %{:w => 3}, body: %{:_id => "0", :a => 1} ) @@ -63,7 +64,8 @@ defmodule WithQuorumTest do rev = resp.body["_rev"] resp = - Couch.put("/#{context[:db_name]}/0", + Couch.put( + "/#{context[:db_name]}/0", query: %{:w => 3}, body: %{:_id => "0", :_rev => rev, :a => 2} ) @@ -85,7 +87,8 @@ defmodule WithQuorumTest do db_name = context[:db_name] Couch.put("/#{db_name}") - Couch.post("/#{context[:db_name]}", + Couch.post( + "/#{context[:db_name]}", body: %{:_id => "0", :a => 1} ) @@ -130,7 +133,8 @@ defmodule WithQuorumTest do rev = resp.body["rev"] resp = - Couch.put("/#{context[:db_name]}/0/foo.txt", + Couch.put( + "/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev}, body: "This is a no bas64 encoded text", headers: ["Content-Type": "text/plain;charset=utf-8"] @@ -155,7 +159,8 @@ defmodule WithQuorumTest do rev = resp.body["rev"] resp = - Couch.put("/#{context[:db_name]}/0/foo.txt", + Couch.put( + "/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev, :w => 3}, body: "This is a no bas64 encoded text", headers: ["Content-Type": "text/plain;charset=utf-8"] @@ -167,7 +172,8 @@ defmodule WithQuorumTest do rev = resp.body["rev"] resp = - Couch.delete("/#{context[:db_name]}/0/foo.txt", + Couch.delete( + "/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev, :w => 3} ) diff --git a/test/elixir/test/cluster_without_quorum_test.exs b/test/elixir/test/cluster_without_quorum_test.exs index a0bdcc37a..4eee1e05a 100644 --- a/test/elixir/test/cluster_without_quorum_test.exs +++ b/test/elixir/test/cluster_without_quorum_test.exs @@ -50,7 +50,8 @@ defmodule WithoutQuorumTest do Couch.put("/#{db_name}") resp = - Couch.post("/#{context[:db_name]}", + Couch.post( + "/#{context[:db_name]}", query: %{:w => 1}, body: %{:_id => "0", :a => 1} ) @@ -62,7 +63,8 @@ defmodule WithoutQuorumTest do rev = resp.body["_rev"] resp = - Couch.put("/#{context[:db_name]}/0", + Couch.put( + "/#{context[:db_name]}/0", query: %{:w => 1}, body: %{:_id => "0", :_rev => rev, :a => 2} ) @@ -84,7 +86,8 @@ defmodule WithoutQuorumTest do db_name = context[:db_name] Couch.put("/#{db_name}") - Couch.post("/#{context[:db_name]}", + Couch.post( + "/#{context[:db_name]}", body: %{:_id => "0", :a => 1} ) @@ -129,7 +132,8 @@ defmodule WithoutQuorumTest do rev = resp.body["rev"] resp = - Couch.put("/#{context[:db_name]}/0/foo.txt", + Couch.put( + "/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev}, body: "This is a no bas64 encoded text", headers: ["Content-Type": "text/plain;charset=utf-8"] @@ -154,7 +158,8 @@ defmodule WithoutQuorumTest do rev = resp.body["rev"] resp = - Couch.put("/#{context[:db_name]}/0/foo.txt", + Couch.put( + "/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev, :w => 1}, body: "This is a no bas64 encoded text", headers: ["Content-Type": "text/plain;charset=utf-8"] @@ -166,7 +171,8 @@ defmodule WithoutQuorumTest do rev = resp.body["rev"] resp = - Couch.delete("/#{context[:db_name]}/0/foo.txt", + Couch.delete( + "/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev, :w => 1} ) diff --git a/test/elixir/test/rewrite_test.exs b/test/elixir/test/rewrite_test.exs index 250eb53d7..51acc8bba 100644 --- a/test/elixir/test/rewrite_test.exs +++ b/test/elixir/test/rewrite_test.exs @@ -285,12 +285,14 @@ defmodule RewriteTest do assert Couch.put("/#{db_name}/_design/test", body: ddoc).body["ok"] - assert Couch.post("/#{db_name}/_bulk_docs", + assert Couch.post( + "/#{db_name}/_bulk_docs", body: %{:docs => docs1}, query: %{w: 3} ).status_code == 201 - assert Couch.post("/#{db_name}/_bulk_docs", + assert Couch.post( + "/#{db_name}/_bulk_docs", body: %{:docs => docs2}, query: %{w: 3} ).status_code == 201 diff --git a/test/elixir/test/security_validation_test.exs b/test/elixir/test/security_validation_test.exs index 5f4ddba8c..56c4ec31b 100644 --- a/test/elixir/test/security_validation_test.exs +++ b/test/elixir/test/security_validation_test.exs @@ -130,7 +130,8 @@ defmodule SecurityValidationTest do headers = @auth_headers[:tom] # attempt to save doc in replication context, eg ?new_edits=false resp = - Couch.put("/#{db_name}/#{ddoc[:_id]}", + Couch.put( + "/#{db_name}/#{ddoc[:_id]}", body: ddoc, headers: headers, query: %{new_edits: false} @@ -164,7 +165,8 @@ defmodule SecurityValidationTest do assert resp.body["reason"] == "Documents must have an author field" # Jerry can write the document - assert Couch.put("/#{db_name}/test_doc", + assert Couch.put( + "/#{db_name}/test_doc", body: %{foo: 1, author: "jerry"}, headers: jerry ).body["ok"] |