diff options
| author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-09-30 17:41:20 +0300 | 
|---|---|---|
| committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-09-30 17:41:20 +0300 | 
| commit | 6ffa2b5f661c2db424334c6fb5de6f4d1bfeb745 (patch) | |
| tree | dd1b2129f3eb7df7b0141cc65ba6c492a36863d0 /test/support | |
| parent | c98e761d28812818971d327800f1fc4c2baa2dbc (diff) | |
| parent | a22a7437d84065192601f73da73d2c27111c9b15 (diff) | |
| download | pleroma-6ffa2b5f661c2db424334c6fb5de6f4d1bfeb745.tar.gz pleroma-6ffa2b5f661c2db424334c6fb5de6f4d1bfeb745.zip | |
[#1260] Merge remote-tracking branch 'remotes/upstream/develop' into 1260-rate-limited-auth-actions
# Conflicts:
#	CHANGELOG.md
Diffstat (limited to 'test/support')
| -rw-r--r-- | test/support/captcha_mock.ex | 2 | ||||
| -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 | 41 | ||||
| -rw-r--r-- | test/support/helpers.ex | 2 | ||||
| -rw-r--r-- | test/support/http_request_mock.ex | 6 | ||||
| -rw-r--r-- | test/support/mrf_module_mock.ex | 2 | ||||
| -rw-r--r-- | test/support/oban_helpers.ex | 2 | ||||
| -rw-r--r-- | test/support/web_push_http_client_mock.ex | 2 | 
9 files changed, 53 insertions, 8 deletions
| diff --git a/test/support/captcha_mock.ex b/test/support/captcha_mock.ex index ef4e68bc5..65ca6b3bd 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Captcha.Mock do diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index b39c70677..9897f72ce 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 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 17fa15214..4ffcbac9e 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 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 719115003..4f3244025 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -71,6 +71,47 @@ defmodule Pleroma.Factory do      }    end +  def audio_factory(attrs \\ %{}) do +    text = sequence(:text, &"lain radio episode #{&1}") + +    user = attrs[:user] || insert(:user) + +    data = %{ +      "type" => "Audio", +      "id" => Pleroma.Web.ActivityPub.Utils.generate_object_id(), +      "artist" => "lain", +      "title" => text, +      "album" => "lain radio", +      "to" => ["https://www.w3.org/ns/activitystreams#Public"], +      "published" => DateTime.utc_now() |> DateTime.to_iso8601(), +      "actor" => user.ap_id, +      "length" => 180_000 +    } + +    %Pleroma.Object{ +      data: merge_attributes(data, Map.get(attrs, :data, %{})) +    } +  end + +  def listen_factory do +    audio = insert(:audio) + +    data = %{ +      "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), +      "type" => "Listen", +      "actor" => audio.data["actor"], +      "to" => audio.data["to"], +      "object" => audio.data, +      "published" => audio.data["published"] +    } + +    %Pleroma.Activity{ +      data: data, +      actor: data["actor"], +      recipients: data["to"] +    } +  end +    def direct_note_factory do      user2 = insert(:user) diff --git a/test/support/helpers.ex b/test/support/helpers.ex index a601b3ec8..ce39dd9d8 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 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 231e7c498..5506c0626 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule HttpRequestMock do @@ -1004,6 +1004,10 @@ defmodule HttpRequestMock do      {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/sjw.json")}}    end +  def get("https://patch.cx/users/rin", _, _, _) do +    {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/rin.json")}} +  end +    def get(url, query, body, headers) do      {:error,       "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{ diff --git a/test/support/mrf_module_mock.ex b/test/support/mrf_module_mock.ex index 12c7e22bc..632c7ff1d 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule MRFModuleMock do diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex index 989770926..72792c064 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Tests.ObanHelpers do diff --git a/test/support/web_push_http_client_mock.ex b/test/support/web_push_http_client_mock.ex index d8accd21c..1d6ccff7e 100644 --- a/test/support/web_push_http_client_mock.ex +++ b/test/support/web_push_http_client_mock.ex @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.WebPushHttpClientMock do | 
