From 8630a6c7f52a68ab32025b1c80a6398599908c68 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 29 Jun 2020 11:41:00 +0200 Subject: [PATCH] Preloaders: Use strings as keys. --- lib/pleroma/web/preload/instance.ex | 6 +++--- lib/pleroma/web/preload/status_net.ex | 2 +- lib/pleroma/web/preload/timelines.ex | 2 +- lib/pleroma/web/preload/user.ex | 4 ++-- test/web/preload/instance_test.exs | 6 +++--- test/web/preload/status_net_test.exs | 2 +- test/web/preload/timeline_test.exs | 2 +- test/web/preload/user_test.exs | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/pleroma/web/preload/instance.ex b/lib/pleroma/web/preload/instance.ex index 3b95fe403..b34d7cf37 100644 --- a/lib/pleroma/web/preload/instance.ex +++ b/lib/pleroma/web/preload/instance.ex @@ -8,9 +8,9 @@ defmodule Pleroma.Web.Preload.Providers.Instance do alias Pleroma.Web.Preload.Providers.Provider @behaviour Provider - @instance_url :"/api/v1/instance" - @panel_url :"/instance/panel.html" - @nodeinfo_url :"/nodeinfo/2.0.json" + @instance_url "/api/v1/instance" + @panel_url "/instance/panel.html" + @nodeinfo_url "/nodeinfo/2.0.json" @impl Provider def generate_terms(_params) do diff --git a/lib/pleroma/web/preload/status_net.ex b/lib/pleroma/web/preload/status_net.ex index 810ad512b..9b62f87a2 100644 --- a/lib/pleroma/web/preload/status_net.ex +++ b/lib/pleroma/web/preload/status_net.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.Preload.Providers.StatusNet do alias Pleroma.Web.TwitterAPI.UtilController @behaviour Provider - @config_url :"/api/statusnet/config.json" + @config_url "/api/statusnet/config.json" @impl Provider def generate_terms(_params) do diff --git a/lib/pleroma/web/preload/timelines.ex b/lib/pleroma/web/preload/timelines.ex index e531b8960..57de04051 100644 --- a/lib/pleroma/web/preload/timelines.ex +++ b/lib/pleroma/web/preload/timelines.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.Preload.Providers.Timelines do alias Pleroma.Web.Preload.Providers.Provider @behaviour Provider - @public_url :"/api/v1/timelines/public" + @public_url "/api/v1/timelines/public" @impl Provider def generate_terms(params) do diff --git a/lib/pleroma/web/preload/user.ex b/lib/pleroma/web/preload/user.ex index 7fef0a4ac..b3d2e9b8d 100644 --- a/lib/pleroma/web/preload/user.ex +++ b/lib/pleroma/web/preload/user.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Web.Preload.Providers.User do alias Pleroma.Web.Preload.Providers.Provider @behaviour Provider - @account_url_base :"/api/v1/accounts" + @account_url_base "/api/v1/accounts" @impl Provider def generate_terms(%{user: user}) do @@ -19,7 +19,7 @@ defmodule Pleroma.Web.Preload.Providers.User do def build_accounts_tag(acc, %User{} = user) do account_data = AccountView.render("show.json", %{user: user, for: user}) - Map.put(acc, :"#{@account_url_base}/#{user.id}", account_data) + Map.put(acc, "#{@account_url_base}/#{user.id}", account_data) end def build_accounts_tag(acc, _), do: acc diff --git a/test/web/preload/instance_test.exs b/test/web/preload/instance_test.exs index 51b9dc549..5bb6c5981 100644 --- a/test/web/preload/instance_test.exs +++ b/test/web/preload/instance_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.Preload.Providers.InstanceTest do setup do: {:ok, Instance.generate_terms(nil)} - test "it renders the info", %{"/api/v1/instance": info} do + test "it renders the info", %{"/api/v1/instance" => info} do assert %{ description: description, email: "admin@example.com", @@ -18,14 +18,14 @@ defmodule Pleroma.Web.Preload.Providers.InstanceTest do assert String.equivalent?(description, "Pleroma: An efficient and flexible fediverse server") end - test "it renders the panel", %{"/instance/panel.html": panel} do + test "it renders the panel", %{"/instance/panel.html" => panel} do assert String.contains?( panel, "

Welcome to Pleroma!

" ) end - test "it renders the node_info", %{"/nodeinfo/2.0.json": nodeinfo} do + test "it renders the node_info", %{"/nodeinfo/2.0.json" => nodeinfo} do %{ metadata: metadata, version: "2.0" diff --git a/test/web/preload/status_net_test.exs b/test/web/preload/status_net_test.exs index 2cdc82930..df7acdb11 100644 --- a/test/web/preload/status_net_test.exs +++ b/test/web/preload/status_net_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.Preload.Providers.StatusNetTest do setup do: {:ok, StatusNet.generate_terms(nil)} - test "it renders the info", %{"/api/statusnet/config.json": info} do + test "it renders the info", %{"/api/statusnet/config.json" => info} do assert {:ok, res} = Jason.decode(info) assert res["site"] end diff --git a/test/web/preload/timeline_test.exs b/test/web/preload/timeline_test.exs index da6a3aded..fea95a6a4 100644 --- a/test/web/preload/timeline_test.exs +++ b/test/web/preload/timeline_test.exs @@ -9,7 +9,7 @@ defmodule Pleroma.Web.Preload.Providers.TimelineTest do alias Pleroma.Web.CommonAPI alias Pleroma.Web.Preload.Providers.Timelines - @public_url :"/api/v1/timelines/public" + @public_url "/api/v1/timelines/public" describe "unauthenticated timeliness when restricted" do setup do diff --git a/test/web/preload/user_test.exs b/test/web/preload/user_test.exs index 68d69d977..83f065e27 100644 --- a/test/web/preload/user_test.exs +++ b/test/web/preload/user_test.exs @@ -26,7 +26,7 @@ defmodule Pleroma.Web.Preload.Providers.UserTest do end test "account is rendered", %{terms: terms, user: user} do - account = terms[:"/api/v1/accounts/#{user.id}"] + account = terms["/api/v1/accounts/#{user.id}"] assert %{acct: user, username: user} = account end end