Fix elixir test formatting
authorJay Doane <jay.s.doane@gmail.com>
Sun, 23 Dec 2018 05:42:31 +0000 (21:42 -0800)
committerJay Doane <jay.s.doane@gmail.com>
Sun, 23 Dec 2018 05:42:31 +0000 (21:42 -0800)
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

test/elixir/test/all_docs_test.exs
test/elixir/test/cluster_with_quorum_test.exs
test/elixir/test/cluster_without_quorum_test.exs
test/elixir/test/rewrite_test.exs
test/elixir/test/security_validation_test.exs

index 21dcb61..1869277 100644 (file)
@@ -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"]
 
index 76fc9b4..d07b18f 100644 (file)
@@ -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}
       )
 
index a0bdcc3..4eee1e0 100644 (file)
@@ -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}
       )
 
index 250eb53..51acc8b 100644 (file)
@@ -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
index 5f4ddba..56c4ec3 100644 (file)
@@ -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"]