diff options
author | tusooa <tusooa@kazv.moe> | 2022-07-31 21:32:49 +0000 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2022-07-31 21:32:49 +0000 |
commit | c80096522cad1255f53e171359bc0266822c6441 (patch) | |
tree | 102a7e13b2e4c11af54e14a9ab0b3be216ce6013 /test/support | |
parent | 9a27cb4f9d314fe1066f566de71357f55926116e (diff) | |
parent | b5266097a1e73bd749d8176e327c14fcb9735f95 (diff) | |
download | pleroma-c80096522cad1255f53e171359bc0266822c6441.tar.gz |
Merge branch 'develop' into 'from/develop/tusooa/emit-move'
# Conflicts:
# CHANGELOG.md
# test/pleroma/user_test.exs
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/api_spec_helpers.ex | 2 | ||||
-rw-r--r-- | test/support/builders/activity_builder.ex | 4 | ||||
-rw-r--r-- | test/support/builders/user_builder.ex | 4 | ||||
-rw-r--r-- | test/support/cachex_proxy.ex | 2 | ||||
-rw-r--r-- | test/support/captcha/mock.ex | 2 | ||||
-rw-r--r-- | test/support/channel_case.ex | 2 | ||||
-rw-r--r-- | test/support/cluster.ex | 4 | ||||
-rw-r--r-- | test/support/conn_case.ex | 2 | ||||
-rw-r--r-- | test/support/data_case.ex | 2 | ||||
-rw-r--r-- | test/support/factory.ex | 14 | ||||
-rw-r--r-- | test/support/helpers.ex | 2 | ||||
-rw-r--r-- | test/support/http_request_mock.ex | 32 | ||||
-rw-r--r-- | test/support/mocks.ex | 2 | ||||
-rw-r--r-- | test/support/mrf_module_mock.ex | 2 | ||||
-rw-r--r-- | test/support/null_cache.ex | 2 | ||||
-rw-r--r-- | test/support/oban_helpers.ex | 2 | ||||
-rw-r--r-- | test/support/websocket_client.ex | 2 |
17 files changed, 68 insertions, 14 deletions
diff --git a/test/support/api_spec_helpers.ex b/test/support/api_spec_helpers.ex index 886e72d73..df5132357 100644 --- a/test/support/api_spec_helpers.ex +++ b/test/support/api_spec_helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tests.ApiSpecHelpers do diff --git a/test/support/builders/activity_builder.ex b/test/support/builders/activity_builder.ex index 7c4950bfa..f1ca3951b 100644 --- a/test/support/builders/activity_builder.ex +++ b/test/support/builders/activity_builder.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Builders.ActivityBuilder do alias Pleroma.Web.ActivityPub.ActivityPub diff --git a/test/support/builders/user_builder.ex b/test/support/builders/user_builder.ex index 6bccbb35a..d6af30612 100644 --- a/test/support/builders/user_builder.ex +++ b/test/support/builders/user_builder.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Builders.UserBuilder do alias Pleroma.Repo alias Pleroma.User diff --git a/test/support/cachex_proxy.ex b/test/support/cachex_proxy.ex index de1f1c766..83ae5610f 100644 --- a/test/support/cachex_proxy.ex +++ b/test/support/cachex_proxy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.CachexProxy do diff --git a/test/support/captcha/mock.ex b/test/support/captcha/mock.ex index 175ade131..53e000ed6 100644 --- a/test/support/captcha/mock.ex +++ b/test/support/captcha/mock.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha.Mock do diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index 1fbf6f100..8cb23f5ab 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ChannelCase do diff --git a/test/support/cluster.ex b/test/support/cluster.ex index 524194cf4..1c923fb0c 100644 --- a/test/support/cluster.ex +++ b/test/support/cluster.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Cluster do @moduledoc """ Facilities for managing a cluster of slave VM's for federated testing. diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index eab469833..f010fec33 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ConnCase do diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 0ee2aa4a2..3c9cab061 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.DataCase do diff --git a/test/support/factory.ex b/test/support/factory.ex index 4a78425ce..efbf3df2e 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Factory do @@ -627,4 +627,16 @@ defmodule Pleroma.Factory do context: ["home"] } end + + def announcement_factory(params \\ %{}) do + data = Map.get(params, :data, %{}) + + {_, params} = Map.pop(params, :data) + + %Pleroma.Announcement{ + data: Map.merge(%{"content" => "test announcement", "all_day" => false}, data) + } + |> Map.merge(params) + |> Pleroma.Announcement.add_rendered_properties() + end end diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 34f1505d0..0bd487f39 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tests.Helpers do diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index dfac773de..eb844e469 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule HttpRequestMock do @@ -1371,6 +1371,36 @@ defmodule HttpRequestMock do }} end + def get("https://gleasonator.com/objects/102eb097-a18b-4cd5-abfc-f952efcb70bb", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/gleasonator-AG3RzWfwEKKrY63qj2.json"), + headers: activitypub_object_headers() + }} + end + + def get("https://gleasonator.com/users/macgirvin", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/macgirvin@gleasonator.com.json"), + headers: activitypub_object_headers() + }} + end + + def get("https://gleasonator.com/users/macgirvin/collections/featured", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: + File.read!("test/fixtures/users_mock/masto_featured.json") + |> String.replace("{{domain}}", "gleasonator.com") + |> String.replace("{{nickname}}", "macgirvin"), + headers: activitypub_object_headers() + }} + end + def get(url, query, body, headers) do {:error, "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{inspect(headers)}"} diff --git a/test/support/mocks.ex b/test/support/mocks.ex index fd8f825b3..d167996bd 100644 --- a/test/support/mocks.ex +++ b/test/support/mocks.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only Mox.defmock(Pleroma.CachexMock, for: Pleroma.Caching) diff --git a/test/support/mrf_module_mock.ex b/test/support/mrf_module_mock.ex index 4d21d7fe0..616fc720e 100644 --- a/test/support/mrf_module_mock.ex +++ b/test/support/mrf_module_mock.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule MRFModuleMock do diff --git a/test/support/null_cache.ex b/test/support/null_cache.ex index 47c10ebb6..9f1d45f1d 100644 --- a/test/support/null_cache.ex +++ b/test/support/null_cache.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.NullCache do diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex index 9b6e5256e..94170a0f8 100644 --- a/test/support/oban_helpers.ex +++ b/test/support/oban_helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tests.ObanHelpers do diff --git a/test/support/websocket_client.ex b/test/support/websocket_client.ex index 34b955474..d149b324e 100644 --- a/test/support/websocket_client.ex +++ b/test/support/websocket_client.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Integration.WebsocketClient do |