From 190fc3912f37577f1c78bb2a6cf80f6309dbabe3 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Wed, 29 Jun 2022 11:44:26 +0100 Subject: [PATCH] Fix tests to work without js --- config/config.exs | 2 +- config/description.exs | 71 ------------------- priv/static/index.html | 2 + .../views/notification_view_test.exs | 7 +- .../web/plugs/instance_static_test.exs | 17 ----- .../web/preload/providers/instance_test.exs | 4 +- 6 files changed, 10 insertions(+), 93 deletions(-) diff --git a/config/config.exs b/config/config.exs index b26eaf153..ad49d521d 100644 --- a/config/config.exs +++ b/config/config.exs @@ -188,7 +188,7 @@ name: "Pleroma", email: "example@example.com", notify_email: "noreply@example.com", - description: "Pleroma: An efficient and flexible fediverse server", + description: "Akkoma: The cooler fediverse server", background_image: "/images/city.jpg", instance_thumbnail: "/instance/thumbnail.jpeg", limit: 5_000, diff --git a/config/description.exs b/config/description.exs index 48e0c59a8..4ca79ad51 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1651,38 +1651,6 @@ } ] }, - %{ - group: :pleroma, - key: :gopher, - type: :group, - description: "Gopher settings", - children: [ - %{ - key: :enabled, - type: :boolean, - description: "Enables the gopher interface" - }, - %{ - key: :ip, - label: "IP", - type: :tuple, - description: "IP address to bind to", - suggestions: [{0, 0, 0, 0}] - }, - %{ - key: :port, - type: :integer, - description: "Port to bind to", - suggestions: [9999] - }, - %{ - key: :dstport, - type: :integer, - description: "Port advertised in URLs (optional, defaults to port)", - suggestions: [9999] - } - ] - }, %{ group: :pleroma, key: :activitypub, @@ -2567,45 +2535,6 @@ } ] }, - %{ - group: :esshd, - label: "ESSHD", - type: :group, - description: - "Before enabling this you must add :esshd to mix.exs as one of the extra_applications " <> - "and generate host keys in your priv dir with ssh-keygen -m PEM -N \"\" -b 2048 -t rsa -f ssh_host_rsa_key", - children: [ - %{ - key: :enabled, - type: :boolean, - description: "Enables SSH" - }, - %{ - key: :priv_dir, - type: :string, - description: "Dir with SSH keys", - suggestions: ["/some/path/ssh_keys"] - }, - %{ - key: :handler, - type: :string, - description: "Handler module", - suggestions: ["Pleroma.BBS.Handler"] - }, - %{ - key: :port, - type: :integer, - description: "Port to connect", - suggestions: [10_022] - }, - %{ - key: :password_authenticator, - type: :string, - description: "Authenticator module", - suggestions: ["Pleroma.BBS.Authenticator"] - } - ] - }, %{ group: :mime, label: "Mime Types", diff --git a/priv/static/index.html b/priv/static/index.html index 2376b50f5..5d0be939e 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -3,4 +3,6 @@

Welcome to Akkoma!

If you're seeing this page, your server works!

In order to get a frontend to show here, you'll need to set up

:pleroma, :frontends, :primary
and install your frontend of choice

+ + diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index b5e36c86b..a22c9df1d 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -238,7 +238,9 @@ test "EmojiReact notification with remote custom emoji" do other_user = insert(:user, local: false) {:ok, activity} = CommonAPI.post(user, %{status: "#morb"}) - {:ok, emoji_react, _} = Builder.emoji_react(other_user, Object.normalize(activity, fetch: false), ":100a:") + + {:ok, emoji_react, _} = + Builder.emoji_react(other_user, Object.normalize(activity, fetch: false), ":100a:") remoteUrl = "http://evil.website/emoji/100a.png" [tag] = emoji_react["tag"] @@ -259,11 +261,12 @@ test "EmojiReact notification with remote custom emoji" do pleroma: %{is_seen: false, is_muted: false}, type: "pleroma:emoji_reaction", emoji: ":100a:", - emoji_url: (if testProxy, do: MediaProxy.encode_url(remoteUrl), else: remoteUrl), + emoji_url: if(testProxy, do: MediaProxy.encode_url(remoteUrl), else: remoteUrl), account: AccountView.render("show.json", %{user: other_user, for: user}), status: StatusView.render("show.json", %{activity: activity, for: user}), created_at: Utils.to_masto_date(notification.inserted_at) } + test_notifications_rendering([notification], user, [expected]) end end diff --git a/test/pleroma/web/plugs/instance_static_test.exs b/test/pleroma/web/plugs/instance_static_test.exs index 46f2ca6b1..aa5dda4d1 100644 --- a/test/pleroma/web/plugs/instance_static_test.exs +++ b/test/pleroma/web/plugs/instance_static_test.exs @@ -45,21 +45,4 @@ test "also overrides frontend files", %{conn: conn} do index = get(conn, "/") assert html_response(index, 200) == "from instance static" end - - test "overrides any file in static/static" do - bundled_index = get(build_conn(), "/static/terms-of-service.html") - - assert html_response(bundled_index, 200) == - File.read!("priv/static/static/terms-of-service.html") - - File.mkdir!(@dir <> "/static") - File.write!(@dir <> "/static/terms-of-service.html", "plz be kind") - - index = get(build_conn(), "/static/terms-of-service.html") - assert html_response(index, 200) == "plz be kind" - - File.write!(@dir <> "/static/kaniini.html", "

rabbit hugs as a service

") - index = get(build_conn(), "/static/kaniini.html") - assert html_response(index, 200) == "

rabbit hugs as a service

" - end end diff --git a/test/pleroma/web/preload/providers/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs index a401475ee..5c6ed6c22 100644 --- a/test/pleroma/web/preload/providers/instance_test.exs +++ b/test/pleroma/web/preload/providers/instance_test.exs @@ -15,13 +15,13 @@ test "it renders the info", %{"/api/v1/instance" => info} do registrations: true } = info - assert String.equivalent?(description, "Pleroma: An efficient and flexible fediverse server") + assert String.equivalent?(description, "Akkoma: The cooler fediverse server") end test "it renders the panel", %{"/instance/panel.html" => panel} do assert String.contains?( panel, - "

Welcome to Pleroma!

" + "

Welcome to Akkoma!

" ) end