some clean up
This commit is contained in:
parent
ce027fd0ef
commit
7676ed8239
8 changed files with 34 additions and 122 deletions
|
|
@ -330,45 +330,6 @@ defmodule Pleroma.ConfigDBTest do
|
|||
{"v1", :v2, Pleroma.Bookmark, 150, false, Phoenix.Socket.V1.JSONSerializer}
|
||||
end
|
||||
|
||||
test "tuple with dispatch key" do
|
||||
binary = ConfigDB.transform(%{"tuple" => [":dispatch", ["{:_,
|
||||
[
|
||||
{\"/api/v1/streaming\", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
||||
{\"/websocket\", Phoenix.Endpoint.CowboyWebSocket,
|
||||
{Phoenix.Transports.WebSocket,
|
||||
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, [path: \"/websocket\"]}}},
|
||||
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
|
||||
]}"]]})
|
||||
|
||||
assert binary ==
|
||||
:erlang.term_to_binary(
|
||||
{:dispatch,
|
||||
[
|
||||
{:_,
|
||||
[
|
||||
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
||||
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
|
||||
{Phoenix.Transports.WebSocket,
|
||||
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, [path: "/websocket"]}}},
|
||||
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
|
||||
]}
|
||||
]}
|
||||
)
|
||||
|
||||
assert ConfigDB.from_binary(binary) ==
|
||||
{:dispatch,
|
||||
[
|
||||
{:_,
|
||||
[
|
||||
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
||||
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
|
||||
{Phoenix.Transports.WebSocket,
|
||||
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, [path: "/websocket"]}}},
|
||||
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
|
||||
]}
|
||||
]}
|
||||
end
|
||||
|
||||
test "map with string key" do
|
||||
binary = ConfigDB.transform(%{"key" => "value"})
|
||||
assert binary == :erlang.term_to_binary(%{"key" => "value"})
|
||||
|
|
|
|||
|
|
@ -2632,69 +2632,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
}
|
||||
end
|
||||
|
||||
test "dispatch setting", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, "/api/pleroma/admin/config", %{
|
||||
configs: [
|
||||
%{
|
||||
"group" => ":pleroma",
|
||||
"key" => "Pleroma.Web.Endpoint.NotReal",
|
||||
"value" => [
|
||||
%{
|
||||
"tuple" => [
|
||||
":http",
|
||||
[
|
||||
%{"tuple" => [":ip", %{"tuple" => [127, 0, 0, 1]}]},
|
||||
%{"tuple" => [":dispatch", ["{:_,
|
||||
[
|
||||
{\"/api/v1/streaming\", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
||||
{\"/websocket\", Phoenix.Endpoint.CowboyWebSocket,
|
||||
{Phoenix.Transports.WebSocket,
|
||||
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, [path: \"/websocket\"]}}},
|
||||
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
|
||||
]}"]]}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
dispatch_string =
|
||||
"{:_, [{\"/api/v1/streaming\", Pleroma.Web.MastodonAPI.WebsocketHandler, []}, " <>
|
||||
"{\"/websocket\", Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, " <>
|
||||
"{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, [path: \"/websocket\"]}}}, " <>
|
||||
"{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}]}"
|
||||
|
||||
assert json_response(conn, 200) == %{
|
||||
"configs" => [
|
||||
%{
|
||||
"group" => ":pleroma",
|
||||
"key" => "Pleroma.Web.Endpoint.NotReal",
|
||||
"value" => [
|
||||
%{
|
||||
"tuple" => [
|
||||
":http",
|
||||
[
|
||||
%{"tuple" => [":ip", %{"tuple" => [127, 0, 0, 1]}]},
|
||||
%{
|
||||
"tuple" => [
|
||||
":dispatch",
|
||||
[
|
||||
dispatch_string
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
test "queues key as atom", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, "/api/pleroma/admin/config", %{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue