New frontend configuration mechanism.
[akkoma] / test / web / twitter_api / util_controller_test.exs
1 defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
2 use Pleroma.Web.ConnCase
3
4 import Pleroma.Factory
5
6 describe "POST /api/pleroma/follow_import" do
7 test "it returns HTTP 200", %{conn: conn} do
8 user1 = insert(:user)
9 user2 = insert(:user)
10
11 response =
12 conn
13 |> assign(:user, user1)
14 |> post("/api/pleroma/follow_import", %{"list" => "#{user2.ap_id}"})
15 |> json_response(:ok)
16
17 assert response == "job started"
18 end
19 end
20
21 describe "POST /api/pleroma/blocks_import" do
22 test "it returns HTTP 200", %{conn: conn} do
23 user1 = insert(:user)
24 user2 = insert(:user)
25
26 response =
27 conn
28 |> assign(:user, user1)
29 |> post("/api/pleroma/blocks_import", %{"list" => "#{user2.ap_id}"})
30 |> json_response(:ok)
31
32 assert response == "job started"
33 end
34 end
35
36 describe "GET /api/pleroma/frontent_configurations" do
37 test "returns everything in :pleroma, :frontend_configurations", %{conn: conn} do
38 config = [
39 frontend_a: %{
40 x: 1,
41 y: 2
42 },
43 frontend_b: %{
44 z: 3
45 }
46 ]
47
48 Pleroma.Config.put(:frontend_configurations, config)
49
50 response =
51 conn
52 |> get("/api/pleroma/frontend_configurations")
53 |> json_response(:ok)
54
55 assert response == Jason.encode!(config |> Enum.into(%{})) |> Jason.decode!()
56 end
57 end
58 end