optimise notifications query
[akkoma] / test / pleroma / web / masto_fe_controller_test.exs
1 defmodule Pleroma.Web.MastoFEControllerTest do
2 use Pleroma.Web.ConnCase, async: true
3 alias Pleroma.Web.MastodonAPI.AuthController
4
5 describe "index/2 (main page)" do
6 test "GET /web/ (glitch-soc)" do
7 clear_config([:frontends, :mastodon], %{"name" => "mastodon-fe"})
8
9 {:ok, masto_app} = AuthController.local_mastofe_app()
10 user = Pleroma.Factory.insert(:user)
11 token = Pleroma.Factory.insert(:oauth_token, app: masto_app, user: user)
12 %{conn: conn} = oauth_access(["read", "write"], oauth_token: token, user: user)
13
14 resp =
15 conn
16 |> get("/web/getting-started")
17 |> html_response(200)
18
19 assert resp =~ "glitch"
20 end
21
22 test "GET /web/ (fedibird)" do
23 clear_config([:frontends, :mastodon], %{"name" => "fedibird-fe"})
24
25 {:ok, masto_app} = AuthController.local_mastofe_app()
26 user = Pleroma.Factory.insert(:user)
27 token = Pleroma.Factory.insert(:oauth_token, app: masto_app, user: user)
28 %{conn: conn} = oauth_access(["read", "write"], oauth_token: token, user: user)
29
30 resp =
31 conn
32 |> get("/web/getting-started")
33 |> html_response(200)
34
35 refute resp =~ "glitch"
36 end
37 end
38 end