From ec5aaf5bd72c91db93a9dbfbe73b58cf7ae5e566 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Fri, 13 Sep 2019 14:59:58 +0300 Subject: [PATCH] fix tests --- .../mastodon_api/mastodon_api_controller_test.exs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 35c2236c8..f899d77d9 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -3626,16 +3626,16 @@ test "returns bad_request if missing required params", %{ res = post(conn, "/api/v1/accounts", valid_params) assert json_response(res, 200) - Enum.each(valid_params, fn {attr, _} -> + [{127,0,0,1}, {127,0,0,2}, {127,0,0,3}, {127,0,0,4}] + |> Stream.zip(valid_params) + |> Enum.each(fn {ip, {attr, _}} -> res = conn - |> Map.put( - :remote_ip, - {:rand.uniform(15), :rand.uniform(15), :rand.uniform(15), :rand.uniform(15)} - ) + |> Map.put(:remote_ip, ip) |> post("/api/v1/accounts", Map.delete(valid_params, attr)) + |> json_response(400) - assert json_response(res, 400) == %{"error" => "Missing parameters"} + assert res == %{"error" => "Missing parameters"} end) end