2018-10-11 17:37:39 +02:00
|
|
|
defmodule MobilizonWeb.PageControllerTest do
|
|
|
|
use MobilizonWeb.ConnCase
|
2018-11-27 17:54:54 +01:00
|
|
|
import Mobilizon.Factory
|
2017-12-08 09:58:14 +01:00
|
|
|
|
2019-03-05 10:13:19 +01:00
|
|
|
setup do
|
|
|
|
conn = build_conn() |> put_req_header("accept", "text/html")
|
|
|
|
{:ok, conn: conn}
|
|
|
|
end
|
|
|
|
|
2017-12-08 09:58:14 +01:00
|
|
|
test "GET /", %{conn: conn} do
|
2018-07-27 10:45:35 +02:00
|
|
|
conn = get(conn, "/")
|
2018-01-13 23:33:03 +01:00
|
|
|
assert html_response(conn, 200)
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
2018-11-27 17:54:54 +01:00
|
|
|
|
2019-03-05 10:13:19 +01:00
|
|
|
test "GET /@actor with existing actor", %{conn: conn} do
|
2018-11-27 17:54:54 +01:00
|
|
|
actor = insert(:actor)
|
|
|
|
conn = get(conn, "/@#{actor.preferred_username}")
|
|
|
|
assert html_response(conn, 200)
|
|
|
|
end
|
2019-03-05 10:13:19 +01: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 09:58:14 +01:00
|
|
|
end
|