defmodule WeberHttpResponseTest do use ExUnit.Case test "SimpleResponse test" do {:ok, status, _, client} = :hackney.request(:get, 'http://localhost:8080/weber', [], <<>>, []) body = :hackney.body(client) assert(body == {:ok, "Main\n"}) assert(status == 200) end test "json response with custom status" do {:ok, status, _, client} = :hackney.request(:get, 'http://localhost:8080/json/action', [], <<>>, []) body = :hackney.body(client) assert(body == {:ok, "{}"}) assert(status == 201) end test "`redirect` in route test" do {:ok, status, _, _client} = :hackney.request(:get, 'http://localhost:8080/redirect', [], <<>>, []) assert(status == 302) end test "`content_for` test" do {:ok, _status, _, client} = :hackney.request(:get, 'http://localhost:8080/content_for', [], <<>>, []) body = :hackney.body(client) assert(body == {:ok, "\n\n
\n