summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2019-01-29 15:04:23 +0200
committergarren smith <garren.smith@gmail.com>2019-01-31 12:22:17 +0200
commit5be58a6ca9ab49668730e7b7150d515df62869f2 (patch)
tree4677b41e7be4af66f9a000eed0928be300d5cf7d
parent547169447067e9111dbd31f2ae86d49afe980fda (diff)
downloadcouchdb-5be58a6ca9ab49668730e7b7150d515df62869f2.tar.gz
fix credo and formatting issues of elixir tests
-rw-r--r--test/elixir/lib/couch.ex4
-rw-r--r--test/elixir/lib/couch/db_test.ex2
-rw-r--r--test/elixir/test/bulk_docs_test.exs9
-rw-r--r--test/elixir/test/lots_of_docs_test.exs9
-rw-r--r--test/elixir/test/partition_all_docs_test.exs12
-rw-r--r--test/elixir/test/partition_crud_test.exs3
-rw-r--r--test/elixir/test/partition_mango_test.exs66
-rw-r--r--test/elixir/test/partition_view_test.exs15
-rw-r--r--test/elixir/test/partition_view_update_test.exs6
9 files changed, 79 insertions, 47 deletions
diff --git a/test/elixir/lib/couch.ex b/test/elixir/lib/couch.ex
index a54ae7597..c4e218f23 100644
--- a/test/elixir/lib/couch.ex
+++ b/test/elixir/lib/couch.ex
@@ -55,8 +55,8 @@ defmodule Couch do
end
def process_url(url) do
- baseUrl = System.get_env("COUCH_URL") || "http://127.0.0.1:15984"
- baseUrl <> url
+ base_url = System.get_env("COUCH_URL") || "http://127.0.0.1:15984"
+ base_url <> url
end
def process_request_headers(headers, options) do
diff --git a/test/elixir/lib/couch/db_test.ex b/test/elixir/lib/couch/db_test.ex
index ba65a6d4e..54e694202 100644
--- a/test/elixir/lib/couch/db_test.ex
+++ b/test/elixir/lib/couch/db_test.ex
@@ -246,7 +246,7 @@ defmodule Couch.DBTest do
inspect(resp, opts)
end
- def restart_cluster() do
+ def restart_cluster do
resp = Couch.get("/_membership")
assert resp.status_code == 200
nodes = resp.body["all_nodes"]
diff --git a/test/elixir/test/bulk_docs_test.exs b/test/elixir/test/bulk_docs_test.exs
index c2e3eedd6..01a3993a6 100644
--- a/test/elixir/test/bulk_docs_test.exs
+++ b/test/elixir/test/bulk_docs_test.exs
@@ -128,11 +128,10 @@ defmodule BulkDocsTest do
defp bulk_post(docs, db) do
resp = Couch.post("/#{db}/_bulk_docs", body: %{docs: docs})
- assert resp.status_code == 201 and length(resp.body) == length(docs),
- """
- Expected 201 and the same number of response rows as in request, but got
- #{pretty_inspect(resp)}
- """
+ assert resp.status_code == 201 and length(resp.body) == length(docs), """
+ Expected 201 and the same number of response rows as in request, but got
+ #{pretty_inspect(resp)}
+ """
resp
end
diff --git a/test/elixir/test/lots_of_docs_test.exs b/test/elixir/test/lots_of_docs_test.exs
index 2c68ca3c4..72e9863af 100644
--- a/test/elixir/test/lots_of_docs_test.exs
+++ b/test/elixir/test/lots_of_docs_test.exs
@@ -101,11 +101,10 @@ defmodule LotsOfDocsTest do
defp bulk_post(docs, db) do
resp = Couch.post("/#{db}/_bulk_docs", body: %{docs: docs})
- assert resp.status_code == 201 and length(resp.body) == length(docs),
- """
- Expected 201 and the same number of response rows as in request, but got
- #{pretty_inspect(resp)}
- """
+ assert resp.status_code == 201 and length(resp.body) == length(docs), """
+ Expected 201 and the same number of response rows as in request, but got
+ #{pretty_inspect(resp)}
+ """
resp
end
diff --git a/test/elixir/test/partition_all_docs_test.exs b/test/elixir/test/partition_all_docs_test.exs
index 87bab341c..5f1066cbe 100644
--- a/test/elixir/test/partition_all_docs_test.exs
+++ b/test/elixir/test/partition_all_docs_test.exs
@@ -126,7 +126,8 @@ defmodule PartitionAllDocsTest do
url = "/#{db_name}/_partition/foo/_all_docs"
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 20
}
@@ -142,7 +143,8 @@ defmodule PartitionAllDocsTest do
assert length(ids) == 50
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 2000
}
@@ -153,7 +155,8 @@ defmodule PartitionAllDocsTest do
assert length(ids) == 50
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 2001
}
@@ -164,7 +167,8 @@ defmodule PartitionAllDocsTest do
assert Regex.match?(~r/Limit is too large/, reason)
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 2000,
skip: 25
diff --git a/test/elixir/test/partition_crud_test.exs b/test/elixir/test/partition_crud_test.exs
index 415dd49bf..f0333450c 100644
--- a/test/elixir/test/partition_crud_test.exs
+++ b/test/elixir/test/partition_crud_test.exs
@@ -280,7 +280,8 @@ defmodule PartitionCrudTest do
assert Map.get(resp, :body) == "This is a text document to save"
resp =
- Couch.put("/#{db_name}/#{id}/bar.txt?rev=#{rev}",
+ Couch.put(
+ "/#{db_name}/#{id}/bar.txt?rev=#{rev}",
headers: ["Content-Type": "text/plain"],
body: "This is another document"
)
diff --git a/test/elixir/test/partition_mango_test.exs b/test/elixir/test/partition_mango_test.exs
index 1471ddb0a..68a26e169 100644
--- a/test/elixir/test/partition_mango_test.exs
+++ b/test/elixir/test/partition_mango_test.exs
@@ -37,7 +37,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
_id: %{
@@ -56,7 +57,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
_id: %{
@@ -82,7 +84,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
_id: %{
@@ -101,7 +104,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
_id: %{
@@ -127,7 +131,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -144,7 +149,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/bar/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -167,7 +173,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -184,7 +191,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/bar/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -207,7 +215,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -225,7 +234,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -250,7 +260,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -269,7 +280,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/bar42/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -294,7 +306,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -313,7 +326,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/bar/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -338,7 +352,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -357,7 +372,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/bar42/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -383,7 +399,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_explain"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -402,7 +419,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/bar/_explain"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -425,7 +443,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_explain"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -442,7 +461,8 @@ defmodule PartitionMangoTest do
assert body["mrargs"]["partition"] == :null
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
some: "field"
@@ -465,7 +485,8 @@ defmodule PartitionMangoTest do
url = "/#{db_name}/_partition/foo/_find"
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
@@ -485,7 +506,8 @@ defmodule PartitionMangoTest do
%{:body => %{"bookmark" => bookmark}} = resp
resp =
- Couch.post(url,
+ Couch.post(
+ url,
body: %{
selector: %{
value: %{
diff --git a/test/elixir/test/partition_view_test.exs b/test/elixir/test/partition_view_test.exs
index 890cb8858..b9fbf179f 100644
--- a/test/elixir/test/partition_view_test.exs
+++ b/test/elixir/test/partition_view_test.exs
@@ -246,7 +246,8 @@ defmodule ViewPartitionTest do
url = "/#{db_name}/_partition/foo/_design/map_some/_view/some"
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
startkey: "[\"field\",\"one\"]",
endkey: "[\"field\",\"one\"]",
@@ -296,7 +297,8 @@ defmodule ViewPartitionTest do
url = "/#{db_name}/_partition/foo/_design/mrtest/_view/some"
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 20
}
@@ -312,7 +314,8 @@ defmodule ViewPartitionTest do
assert length(ids) == 50
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 2000
}
@@ -323,7 +326,8 @@ defmodule ViewPartitionTest do
assert length(ids) == 50
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 2001
}
@@ -334,7 +338,8 @@ defmodule ViewPartitionTest do
assert Regex.match?(~r/Limit is too large/, reason)
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
limit: 2000,
skip: 25
diff --git a/test/elixir/test/partition_view_update_test.exs b/test/elixir/test/partition_view_update_test.exs
index 502d5fabe..8f298b391 100644
--- a/test/elixir/test/partition_view_update_test.exs
+++ b/test/elixir/test/partition_view_update_test.exs
@@ -38,7 +38,8 @@ defmodule PartitionViewUpdateTest do
url = "/#{db_name}/_partition/foo/_design/mrtest/_view/some"
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
update: "true",
limit: 3
@@ -59,7 +60,8 @@ defmodule PartitionViewUpdateTest do
Couch.put("/#{db_name}/foo:1", body: %{some: "field"})
resp =
- Couch.get(url,
+ Couch.get(
+ url,
query: %{
update: "false",
limit: 3