Merge remote-tracking branch 'origin/develop' into paradedb-search-backend
This commit is contained in:
commit
9fdc1a8d3b
15 changed files with 196 additions and 6 deletions
|
|
@ -294,7 +294,7 @@ defmodule Pleroma.ReverseProxyTest do
|
|||
|> expect(:stream_body, fn _ -> :done end)
|
||||
|
||||
conn = ReverseProxy.call(conn, "/cache")
|
||||
assert {"cache-control", "public, max-age=1209600"} in conn.resp_headers
|
||||
assert {"cache-control", "public, max-age=1209600, immutable"} in conn.resp_headers
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -170,4 +170,23 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do
|
|||
|
||||
assert {:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
|
||||
end
|
||||
|
||||
test "it displays voters count for a poll" do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{
|
||||
status: "???",
|
||||
poll: %{expires_in: 10, options: ["yes", "no"]}
|
||||
})
|
||||
|
||||
object = Object.normalize(activity, fetch: false)
|
||||
{:ok, _, _} = CommonAPI.vote(object, other_user, [1])
|
||||
|
||||
{:ok, modified} = Transmogrifier.prepare_activity(activity.data)
|
||||
|
||||
refute Map.has_key?(modified["object"], "voters")
|
||||
assert modified["object"]["votersCount"] == 1
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -167,7 +167,14 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
|
|||
} = PollView.render("show.json", %{object: object})
|
||||
end
|
||||
|
||||
test "that poll is non anonymous" do
|
||||
test "displays correct voters count" do
|
||||
object = Object.normalize("https://friends.grishka.me/posts/54642", fetch: true)
|
||||
result = PollView.render("show.json", %{object: object})
|
||||
|
||||
assert result[:voters_count] == 14
|
||||
end
|
||||
|
||||
test "detects that poll is non anonymous" do
|
||||
object = Object.normalize("https://friends.grishka.me/posts/54642", fetch: true)
|
||||
result = PollView.render("show.json", %{object: object})
|
||||
|
||||
|
|
|
|||
63
test/pleroma/web/plugs/favicon_plug_test.exs
Normal file
63
test/pleroma/web/plugs/favicon_plug_test.exs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2026 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.Plugs.FaviconPlugTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
@dir "test/tmp/favicon_static"
|
||||
|
||||
setup do
|
||||
Pleroma.Backports.mkdir_p!(@dir)
|
||||
|
||||
on_exit(fn -> File.rm_rf!(@dir) end)
|
||||
end
|
||||
|
||||
describe "default favicon" do
|
||||
test "returns favicon", %{conn: conn} do
|
||||
conn = get(conn, "/favicon.png")
|
||||
body_size = byte_size(conn.resp_body)
|
||||
|
||||
assert conn.status == 200
|
||||
assert body_size == 1583
|
||||
assert response_content_type(conn, :png)
|
||||
end
|
||||
|
||||
test "returns correct cache-control", %{conn: conn} do
|
||||
conn = get(conn, "/favicon.png")
|
||||
cache = get_resp_header(conn, "cache-control")
|
||||
|
||||
assert conn.status == 200
|
||||
assert cache == ["public, max=age=86400, immutable"]
|
||||
end
|
||||
end
|
||||
|
||||
describe "custom favicon" do
|
||||
setup do
|
||||
favicon_path = Path.join(@dir, "favicon.png")
|
||||
donor_image = "test/fixtures/image.png"
|
||||
|
||||
File.cp!(donor_image, favicon_path)
|
||||
clear_config([:instance, :static_dir], @dir)
|
||||
|
||||
on_exit(fn -> File.rm!(favicon_path) end)
|
||||
end
|
||||
|
||||
test "returns favicon", %{conn: conn} do
|
||||
conn = get(conn, "/favicon.png")
|
||||
body_size = byte_size(conn.resp_body)
|
||||
|
||||
assert conn.status == 200
|
||||
assert body_size == 104_426
|
||||
assert response_content_type(conn, :png)
|
||||
end
|
||||
|
||||
test "returns correct cache-control", %{conn: conn} do
|
||||
conn = get(conn, "/favicon.png")
|
||||
cache = get_resp_header(conn, "cache-control")
|
||||
|
||||
assert conn.status == 200
|
||||
assert cache == ["public, max=age=86400, immutable"]
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue