fix tests

This commit is contained in:
Maksim Pechnikov 2019-09-13 14:59:58 +03:00
parent d8a178274b
commit ec5aaf5bd7
1 changed files with 6 additions and 6 deletions

View File

@ -3626,16 +3626,16 @@ test "returns bad_request if missing required params", %{
res = post(conn, "/api/v1/accounts", valid_params) res = post(conn, "/api/v1/accounts", valid_params)
assert json_response(res, 200) 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 = res =
conn conn
|> Map.put( |> Map.put(:remote_ip, ip)
:remote_ip,
{:rand.uniform(15), :rand.uniform(15), :rand.uniform(15), :rand.uniform(15)}
)
|> post("/api/v1/accounts", Map.delete(valid_params, attr)) |> 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)
end end