2018-10-11 15:37:39 +00:00
|
|
|
defmodule MobilizonWeb.PageControllerTest do
|
|
|
|
use MobilizonWeb.ConnCase
|
2018-11-27 16:54:54 +00:00
|
|
|
import Mobilizon.Factory
|
2017-12-08 08:58:14 +00:00
|
|
|
|
2019-03-05 09:13:19 +00:00
|
|
|
setup do
|
|
|
|
conn = build_conn() |> put_req_header("accept", "text/html")
|
|
|
|
{:ok, conn: conn}
|
|
|
|
end
|
|
|
|
|
2017-12-08 08:58:14 +00:00
|
|
|
test "GET /", %{conn: conn} do
|
2018-07-27 08:45:35 +00:00
|
|
|
conn = get(conn, "/")
|
2018-01-13 22:33:03 +00:00
|
|
|
assert html_response(conn, 200)
|
2017-12-08 08:58:14 +00:00
|
|
|
end
|
2018-11-27 16:54:54 +00:00
|
|
|
|
2019-03-05 09:13:19 +00:00
|
|
|
test "GET /@actor with existing actor", %{conn: conn} do
|
2018-11-27 16:54:54 +00:00
|
|
|
actor = insert(:actor)
|
|
|
|
conn = get(conn, "/@#{actor.preferred_username}")
|
|
|
|
assert html_response(conn, 200)
|
|
|
|
end
|
2019-03-05 09:13:19 +00:00
|
|
|
|
|
|
|
test "GET /@actor with not existing actor", %{conn: conn} do
|
|
|
|
conn = get(conn, "/@notexisting")
|
|
|
|
assert html_response(conn, 404)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "GET /events/:uuid", %{conn: conn} do
|
|
|
|
event = insert(:event)
|
|
|
|
conn = get(conn, "/events/#{event.uuid}")
|
|
|
|
assert html_response(conn, 200)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "GET /events/:uuid with not existing event", %{conn: conn} do
|
|
|
|
conn = get(conn, "/events/not_existing_event")
|
|
|
|
assert html_response(conn, 404)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "GET /events/:uuid with event not public", %{conn: conn} do
|
|
|
|
event = insert(:event, visibility: :restricted)
|
|
|
|
conn = get(conn, "/events/#{event.uuid}")
|
|
|
|
assert html_response(conn, 404)
|
|
|
|
end
|
|
|
|
|
|
|
|
# TODO: Comments
|
2017-12-08 08:58:14 +00:00
|
|
|
end
|