Remove vapidPublicKey from Nodeinfo
[akkoma] / test / web / mastodon_api / controllers / suggestion_controller_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
6 use Pleroma.Web.ConnCase
7
8 alias Pleroma.Config
9
10 import Pleroma.Factory
11 import Tesla.Mock
12
13 setup do: oauth_access(["read"])
14
15 setup %{user: user} do
16 other_user = insert(:user)
17 host = Config.get([Pleroma.Web.Endpoint, :url, :host])
18 url500 = "http://test500?#{host}&#{user.nickname}"
19 url200 = "http://test200?#{host}&#{user.nickname}"
20
21 mock(fn
22 %{method: :get, url: ^url500} ->
23 %Tesla.Env{status: 500, body: "bad request"}
24
25 %{method: :get, url: ^url200} ->
26 %Tesla.Env{
27 status: 200,
28 body:
29 ~s([{"acct":"yj455","avatar":"https://social.heldscal.la/avatar/201.jpeg","avatar_static":"https://social.heldscal.la/avatar/s/201.jpeg"}, {"acct":"#{
30 other_user.ap_id
31 }","avatar":"https://social.heldscal.la/avatar/202.jpeg","avatar_static":"https://social.heldscal.la/avatar/s/202.jpeg"}])
32 }
33 end)
34
35 [other_user: other_user]
36 end
37
38 test "returns empty result", %{conn: conn} do
39 res =
40 conn
41 |> get("/api/v1/suggestions")
42 |> json_response(200)
43
44 assert res == []
45 end
46 end