logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 02acf7c0b3e6711262f9f57cfc0554ce8e4ed50d
parent 29d202e1df0cfbe110059815ca654ed1d3d93e41
Author: lain <lain@soykaf.club>
Date:   Wed, 13 Dec 2023 10:05:18 +0000

Merge branch 'fix-develop-tests' into 'develop'

StatusViewTest: Fix tests.

See merge request pleroma/pleroma!3998

Diffstat:

M.gitlab-ci.yml18+-----------------
Achangelog.d/fix-tests.skip0
Aci/postgres_rum/Dockerfile3+++
Aci/postgres_rum/build_and_push.sh1+
Mtest/pleroma/web/mastodon_api/views/status_view_test.exs8+++++++-
5 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml @@ -154,22 +154,6 @@ unit-testing-erratic: - mix ecto.migrate - mix test --only=erratic -# Removed to fix CI issue. In this early state it wasn't adding much value anyway. -# TODO Fix and reinstate federated testing -# federated-testing: -# stage: test -# cache: *testing_cache_policy -# services: -# - name: minibikini/postgres-with-rum:12 -# alias: postgres -# command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] -# script: -# - mix deps.get -# - mix ecto.create -# - mix ecto.migrate -# - epmd -daemon -# - mix test --trace --only federated - unit-testing-rum: extends: - .build_changes_policy @@ -177,7 +161,7 @@ unit-testing-rum: stage: test cache: *testing_cache_policy services: - - name: minibikini/postgres-with-rum:12 + - name: git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13 alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] variables: diff --git a/changelog.d/fix-tests.skip b/changelog.d/fix-tests.skip diff --git a/ci/postgres_rum/Dockerfile b/ci/postgres_rum/Dockerfile @@ -0,0 +1,3 @@ +FROM postgres:13-bullseye + +RUN apt-get update && apt-get install -y postgresql-13-rum/bullseye-pgdg diff --git a/ci/postgres_rum/build_and_push.sh b/ci/postgres_rum/build_and_push.sh @@ -0,0 +1 @@ +docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13:latest --push . diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -11,6 +11,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do alias Pleroma.HTML alias Pleroma.Object alias Pleroma.Repo + alias Pleroma.UnstubbedConfigMock, as: ConfigMock alias Pleroma.User alias Pleroma.UserRelationship alias Pleroma.Web.CommonAPI @@ -19,9 +20,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do require Bitwise + import Mox + import OpenApiSpex.TestAssertions import Pleroma.Factory import Tesla.Mock - import OpenApiSpex.TestAssertions setup do mock(fn env -> apply(HttpRequestMock, :request, [env]) end) @@ -198,6 +200,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec()) end + @tag capture_log: true test "returns a temporary ap_id based user for activities missing db users" do user = insert(:user) @@ -784,6 +787,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do clear_config([:media_proxy, :enabled], true) clear_config([:media_preview_proxy, :enabled]) + ConfigMock + |> stub_with(Pleroma.Test.StaticConfig) + page_url = "http://example.com" card = %{