From 336e37d98f1b86c0332c9f260e27455a14714fa6 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Fri, 21 Dec 2018 00:32:37 +0300 Subject: Make captcha (kocaptcha) stateless Also rename seconds_retained to seconds_valid since that's how it is now. Put it down from 180 to 20 seconds. The answer data is now stored in an encrypted text transfered to the client and back, so no ETS is needed --- test/support/captcha_mock.ex | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test/support') diff --git a/test/support/captcha_mock.ex b/test/support/captcha_mock.ex index 898aa17b8..410318dc4 100644 --- a/test/support/captcha_mock.ex +++ b/test/support/captcha_mock.ex @@ -6,8 +6,5 @@ defmodule Pleroma.Captcha.Mock do def new(), do: %{type: :mock} @impl Service - def validate(_token, _captcha), do: true - - @impl Service - def cleanup(), do: :ok + def validate(_token, _captcha, _data), do: :ok end -- cgit v1.2.3 From 3c08d229db423052d0dd88b8a36fb39b0ae81ead Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 23 Dec 2018 20:11:29 +0000 Subject: tests: add legal boilerplate --- test/support/captcha_mock.ex | 4 ++++ test/support/channel_case.ex | 4 ++++ test/support/conn_case.ex | 4 ++++ test/support/data_case.ex | 4 ++++ test/support/factory.ex | 4 ++++ test/support/helpers.ex | 4 ++++ test/support/http_request_mock.ex | 4 ++++ test/support/ostatus_mock.ex | 4 ++++ test/support/websocket_client.ex | 4 ++++ test/support/websub_mock.ex | 4 ++++ 10 files changed, 40 insertions(+) (limited to 'test/support') diff --git a/test/support/captcha_mock.ex b/test/support/captcha_mock.ex index 898aa17b8..3ab02916f 100644 --- a/test/support/captcha_mock.ex +++ b/test/support/captcha_mock.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Captcha.Mock do alias Pleroma.Captcha.Service @behaviour Service diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index 68995a01d..466d8986f 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.ChannelCase do @moduledoc """ This module defines the test case to be used by diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index d25c28f49..c201d9a9b 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.ConnCase do @moduledoc """ This module defines the test case to be used by diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 53e7234d2..56d5896ad 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.DataCase do @moduledoc """ This module defines the setup for tests requiring diff --git a/test/support/factory.ex b/test/support/factory.ex index 2889d8977..e5c0c5bcc 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Factory do use ExMachina.Ecto, repo: Pleroma.Repo diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 64b6b1900..6e389ce52 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Tests.Helpers do @moduledoc """ Helpers for use in tests. diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 6f98fc5d0..e4279e14d 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule HttpRequestMock do require Logger diff --git a/test/support/ostatus_mock.ex b/test/support/ostatus_mock.ex index 36865ae02..9c0f2f323 100644 --- a/test/support/ostatus_mock.ex +++ b/test/support/ostatus_mock.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.OStatusMock do import Pleroma.Factory diff --git a/test/support/websocket_client.ex b/test/support/websocket_client.ex index 57e9bb17f..121231452 100644 --- a/test/support/websocket_client.ex +++ b/test/support/websocket_client.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Integration.WebsocketClient do # https://github.com/phoenixframework/phoenix/blob/master/test/support/websocket_client.exs diff --git a/test/support/websub_mock.ex b/test/support/websub_mock.ex index 0cba0b740..e3d5a5b16 100644 --- a/test/support/websub_mock.ex +++ b/test/support/websub_mock.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.WebsubMock do def verify(sub) do {:ok, sub} -- cgit v1.2.3 From 2d7da5f4375164aa78e221ab054529a04d09e819 Mon Sep 17 00:00:00 2001 From: sxsdv1 Date: Sat, 5 Jan 2019 10:38:38 +0100 Subject: Don't crash on AP request for tombstone Because tombstone objects has no addressing the is_public?-predicate would cause an error that propagated as a 500 error in the api --- test/support/factory.ex | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/support') diff --git a/test/support/factory.ex b/test/support/factory.ex index e5c0c5bcc..57fa4a79d 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -57,6 +57,19 @@ defmodule Pleroma.Factory do %Pleroma.Object{data: Map.merge(data, %{"to" => [user2.ap_id]})} end + def tombstone_factory do + data = %{ + "type" => "Tombstone", + "id" => Pleroma.Web.ActivityPub.Utils.generate_object_id(), + "formerType" => "Note", + "deleted" => DateTime.utc_now() |> DateTime.to_iso8601() + } + + %Pleroma.Object{ + data: data + } + end + def direct_note_activity_factory do dm = insert(:direct_note) -- cgit v1.2.3