diff options
Diffstat (limited to 'test')
101 files changed, 539 insertions, 226 deletions
diff --git a/test/activity_expiration_test.exs b/test/activity_expiration_test.exs index 2fc593b8c..4cda5e985 100644 --- a/test/activity_expiration_test.exs +++ b/test/activity_expiration_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.ActivityExpirationTest do diff --git a/test/activity_test.exs b/test/activity_test.exs index 8aeece96d..46b55beaa 100644 --- a/test/activity_test.exs +++ b/test/activity_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.ActivityTest do diff --git a/test/config/config_db_test.exs b/test/config/config_db_test.exs index 812709fd8..ac3dde681 100644 --- a/test/config/config_db_test.exs +++ b/test/config/config_db_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.ConfigDBTest do diff --git a/test/config/holder_test.exs b/test/config/holder_test.exs index 0c1882d0f..2368d4856 100644 --- a/test/config/holder_test.exs +++ b/test/config/holder_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Config.HolderTest do diff --git a/test/config/loader_test.exs b/test/config/loader_test.exs index 0dd4c60bb..4c93e5d4d 100644 --- a/test/config/loader_test.exs +++ b/test/config/loader_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Config.LoaderTest do diff --git a/test/config/transfer_task_test.exs b/test/config/transfer_task_test.exs index 3d7218dde..ce31d1e87 100644 --- a/test/config/transfer_task_test.exs +++ b/test/config/transfer_task_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Config.TransferTaskTest do diff --git a/test/conversation/participation_test.exs b/test/conversation/participation_test.exs index ab9f27b2f..3536842e8 100644 --- a/test/conversation/participation_test.exs +++ b/test/conversation/participation_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Conversation.ParticipationTest do diff --git a/test/emails/admin_email_test.exs b/test/emails/admin_email_test.exs index 383cc3459..bc871a0a9 100644 --- a/test/emails/admin_email_test.exs +++ b/test/emails/admin_email_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Emails.AdminEmailTest do diff --git a/test/emoji/formatter_test.exs b/test/emoji/formatter_test.exs index fda80d470..3bfee9420 100644 --- a/test/emoji/formatter_test.exs +++ b/test/emoji/formatter_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Emoji.FormatterTest do diff --git a/test/federation/federation_test.exs b/test/federation/federation_test.exs index 45800568a..10d71fb88 100644 --- a/test/federation/federation_test.exs +++ b/test/federation/federation_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Integration.FederationTest do diff --git a/test/fixtures/modules/runtime_module.ex b/test/fixtures/modules/runtime_module.ex index 4711c3532..f11032b57 100644 --- a/test/fixtures/modules/runtime_module.ex +++ b/test/fixtures/modules/runtime_module.ex @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule RuntimeModule do diff --git a/test/formatter_test.exs b/test/formatter_test.exs index 37f8bb800..cf8441cf6 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.FormatterTest do diff --git a/test/http/request_builder_test.exs b/test/http/request_builder_test.exs index 113158c9f..11a9314ae 100644 --- a/test/http/request_builder_test.exs +++ b/test/http/request_builder_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.HTTP.RequestBuilderTest do diff --git a/test/notification_test.exs b/test/notification_test.exs index 04bf5b41a..56a581810 100644 --- a/test/notification_test.exs +++ b/test/notification_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.NotificationTest do diff --git a/test/object/fetcher_test.exs b/test/object/fetcher_test.exs index 3afd35648..4775ee152 100644 --- a/test/object/fetcher_test.exs +++ b/test/object/fetcher_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Object.FetcherTest do diff --git a/test/object_test.exs b/test/object_test.exs index 75f192da2..85b2a3f6d 100644 --- a/test/object_test.exs +++ b/test/object_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.ObjectTest do diff --git a/test/plugs/admin_secret_authentication_plug_test.exs b/test/plugs/admin_secret_authentication_plug_test.exs index e41ce1825..2e300ac0c 100644 --- a/test/plugs/admin_secret_authentication_plug_test.exs +++ b/test/plugs/admin_secret_authentication_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Plugs.AdminSecretAuthenticationPlugTest do diff --git a/test/plugs/http_security_plug_test.exs b/test/plugs/http_security_plug_test.exs index aa285d827..944a9a139 100644 --- a/test/plugs/http_security_plug_test.exs +++ b/test/plugs/http_security_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do diff --git a/test/plugs/http_signature_plug_test.exs b/test/plugs/http_signature_plug_test.exs index 55e8bafc0..e6cbde803 100644 --- a/test/plugs/http_signature_plug_test.exs +++ b/test/plugs/http_signature_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Plugs.HTTPSignaturePlugTest do diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/plugs/oauth_scopes_plug_test.exs index ce426677b..1b3aa85b6 100644 --- a/test/plugs/oauth_scopes_plug_test.exs +++ b/test/plugs/oauth_scopes_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Plugs.OAuthScopesPlugTest do diff --git a/test/plugs/rate_limiter_test.exs b/test/plugs/rate_limiter_test.exs index 06ffa7b70..8023271e4 100644 --- a/test/plugs/rate_limiter_test.exs +++ b/test/plugs/rate_limiter_test.exs @@ -1,74 +1,84 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Plugs.RateLimiterTest do    use ExUnit.Case, async: true    use Plug.Test +  alias Pleroma.Config    alias Pleroma.Plugs.RateLimiter    import Pleroma.Factory +  import Pleroma.Tests.Helpers, only: [clear_config: 1, clear_config: 2]    # Note: each example must work with separate buckets in order to prevent concurrency issues +  clear_config([Pleroma.Web.Endpoint, :http, :ip]) +  clear_config(:rate_limit) +    describe "config" do +    @limiter_name :test_init + +    clear_config([Pleroma.Plugs.RemoteIp, :enabled]) +      test "config is required for plug to work" do -      limiter_name = :test_init -      Pleroma.Config.put([:rate_limit, limiter_name], {1, 1}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, @limiter_name], {1, 1}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8})        assert %{limits: {1, 1}, name: :test_init, opts: [name: :test_init]} == -               RateLimiter.init(name: limiter_name) - -      assert nil == RateLimiter.init(name: :foo) +               [name: @limiter_name] +               |> RateLimiter.init() +               |> RateLimiter.action_settings() + +      assert nil == +               [name: :nonexisting_limiter] +               |> RateLimiter.init() +               |> RateLimiter.action_settings()      end      test "it is disabled for localhost" do -      limiter_name = :test_init -      Pleroma.Config.put([:rate_limit, limiter_name], {1, 1}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {127, 0, 0, 1}) -      Pleroma.Config.put([Pleroma.Plugs.RemoteIp, :enabled], false) +      Config.put([:rate_limit, @limiter_name], {1, 1}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {127, 0, 0, 1}) +      Config.put([Pleroma.Plugs.RemoteIp, :enabled], false)        assert RateLimiter.disabled?() == true      end      test "it is disabled for socket" do -      limiter_name = :test_init -      Pleroma.Config.put([:rate_limit, limiter_name], {1, 1}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {:local, "/path/to/pleroma.sock"}) -      Pleroma.Config.put([Pleroma.Plugs.RemoteIp, :enabled], false) +      Config.put([:rate_limit, @limiter_name], {1, 1}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {:local, "/path/to/pleroma.sock"}) +      Config.put([Pleroma.Plugs.RemoteIp, :enabled], false)        assert RateLimiter.disabled?() == true      end      test "it is enabled for socket when remote ip is enabled" do -      limiter_name = :test_init -      Pleroma.Config.put([:rate_limit, limiter_name], {1, 1}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {:local, "/path/to/pleroma.sock"}) -      Pleroma.Config.put([Pleroma.Plugs.RemoteIp, :enabled], true) +      Config.put([:rate_limit, @limiter_name], {1, 1}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {:local, "/path/to/pleroma.sock"}) +      Config.put([Pleroma.Plugs.RemoteIp, :enabled], true)        assert RateLimiter.disabled?() == false      end      test "it restricts based on config values" do -      limiter_name = :test_opts +      limiter_name = :test_plug_opts        scale = 80        limit = 5 -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) -      Pleroma.Config.put([:rate_limit, limiter_name], {scale, limit}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, limiter_name], {scale, limit}) -      opts = RateLimiter.init(name: limiter_name) +      plug_opts = RateLimiter.init(name: limiter_name)        conn = conn(:get, "/")        for i <- 1..5 do -        conn = RateLimiter.call(conn, opts) -        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, opts) +        conn = RateLimiter.call(conn, plug_opts) +        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)          Process.sleep(10)        end -      conn = RateLimiter.call(conn, opts) +      conn = RateLimiter.call(conn, plug_opts)        assert %{"error" => "Throttled"} = Phoenix.ConnTest.json_response(conn, :too_many_requests)        assert conn.halted @@ -76,8 +86,8 @@ defmodule Pleroma.Plugs.RateLimiterTest do        conn = conn(:get, "/") -      conn = RateLimiter.call(conn, opts) -      assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, opts) +      conn = RateLimiter.call(conn, plug_opts) +      assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)        refute conn.status == Plug.Conn.Status.code(:too_many_requests)        refute conn.resp_body @@ -89,78 +99,81 @@ defmodule Pleroma.Plugs.RateLimiterTest do      test "`bucket_name` option overrides default bucket name" do        limiter_name = :test_bucket_name -      Pleroma.Config.put([:rate_limit, limiter_name], {1000, 5}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, limiter_name], {1000, 5}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8})        base_bucket_name = "#{limiter_name}:group1" -      opts = RateLimiter.init(name: limiter_name, bucket_name: base_bucket_name) +      plug_opts = RateLimiter.init(name: limiter_name, bucket_name: base_bucket_name)        conn = conn(:get, "/") -      RateLimiter.call(conn, opts) -      assert {1, 4} = RateLimiter.inspect_bucket(conn, base_bucket_name, opts) -      assert {:err, :not_found} = RateLimiter.inspect_bucket(conn, limiter_name, opts) +      RateLimiter.call(conn, plug_opts) +      assert {1, 4} = RateLimiter.inspect_bucket(conn, base_bucket_name, plug_opts) +      assert {:error, :not_found} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)      end      test "`params` option allows different queries to be tracked independently" do        limiter_name = :test_params -      Pleroma.Config.put([:rate_limit, limiter_name], {1000, 5}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, limiter_name], {1000, 5}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) -      opts = RateLimiter.init(name: limiter_name, params: ["id"]) +      plug_opts = RateLimiter.init(name: limiter_name, params: ["id"])        conn = conn(:get, "/?id=1")        conn = Plug.Conn.fetch_query_params(conn)        conn_2 = conn(:get, "/?id=2") -      RateLimiter.call(conn, opts) -      assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, opts) -      assert {0, 5} = RateLimiter.inspect_bucket(conn_2, limiter_name, opts) +      RateLimiter.call(conn, plug_opts) +      assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts) +      assert {0, 5} = RateLimiter.inspect_bucket(conn_2, limiter_name, plug_opts)      end      test "it supports combination of options modifying bucket name" do        limiter_name = :test_options_combo -      Pleroma.Config.put([:rate_limit, limiter_name], {1000, 5}) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, limiter_name], {1000, 5}) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8})        base_bucket_name = "#{limiter_name}:group1" -      opts = RateLimiter.init(name: limiter_name, bucket_name: base_bucket_name, params: ["id"]) + +      plug_opts = +        RateLimiter.init(name: limiter_name, bucket_name: base_bucket_name, params: ["id"]) +        id = "100"        conn = conn(:get, "/?id=#{id}")        conn = Plug.Conn.fetch_query_params(conn)        conn_2 = conn(:get, "/?id=#{101}") -      RateLimiter.call(conn, opts) -      assert {1, 4} = RateLimiter.inspect_bucket(conn, base_bucket_name, opts) -      assert {0, 5} = RateLimiter.inspect_bucket(conn_2, base_bucket_name, opts) +      RateLimiter.call(conn, plug_opts) +      assert {1, 4} = RateLimiter.inspect_bucket(conn, base_bucket_name, plug_opts) +      assert {0, 5} = RateLimiter.inspect_bucket(conn_2, base_bucket_name, plug_opts)      end    end    describe "unauthenticated users" do      test "are restricted based on remote IP" do        limiter_name = :test_unauthenticated -      Pleroma.Config.put([:rate_limit, limiter_name], [{1000, 5}, {1, 10}]) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, limiter_name], [{1000, 5}, {1, 10}]) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) -      opts = RateLimiter.init(name: limiter_name) +      plug_opts = RateLimiter.init(name: limiter_name)        conn = %{conn(:get, "/") | remote_ip: {127, 0, 0, 2}}        conn_2 = %{conn(:get, "/") | remote_ip: {127, 0, 0, 3}}        for i <- 1..5 do -        conn = RateLimiter.call(conn, opts) -        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, opts) +        conn = RateLimiter.call(conn, plug_opts) +        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)          refute conn.halted        end -      conn = RateLimiter.call(conn, opts) +      conn = RateLimiter.call(conn, plug_opts)        assert %{"error" => "Throttled"} = Phoenix.ConnTest.json_response(conn, :too_many_requests)        assert conn.halted -      conn_2 = RateLimiter.call(conn_2, opts) -      assert {1, 4} = RateLimiter.inspect_bucket(conn_2, limiter_name, opts) +      conn_2 = RateLimiter.call(conn_2, plug_opts) +      assert {1, 4} = RateLimiter.inspect_bucket(conn_2, limiter_name, plug_opts)        refute conn_2.status == Plug.Conn.Status.code(:too_many_requests)        refute conn_2.resp_body @@ -175,37 +188,37 @@ defmodule Pleroma.Plugs.RateLimiterTest do        :ok      end -    test "can have limits seperate from unauthenticated connections" do -      limiter_name = :test_authenticated +    test "can have limits separate from unauthenticated connections" do +      limiter_name = :test_authenticated1        scale = 50        limit = 5 -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) -      Pleroma.Config.put([:rate_limit, limiter_name], [{1000, 1}, {scale, limit}]) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +      Config.put([:rate_limit, limiter_name], [{1000, 1}, {scale, limit}]) -      opts = RateLimiter.init(name: limiter_name) +      plug_opts = RateLimiter.init(name: limiter_name)        user = insert(:user)        conn = conn(:get, "/") |> assign(:user, user)        for i <- 1..5 do -        conn = RateLimiter.call(conn, opts) -        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, opts) +        conn = RateLimiter.call(conn, plug_opts) +        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)          refute conn.halted        end -      conn = RateLimiter.call(conn, opts) +      conn = RateLimiter.call(conn, plug_opts)        assert %{"error" => "Throttled"} = Phoenix.ConnTest.json_response(conn, :too_many_requests)        assert conn.halted      end -    test "diffrerent users are counted independently" do -      limiter_name = :test_authenticated -      Pleroma.Config.put([:rate_limit, limiter_name], [{1, 10}, {1000, 5}]) -      Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) +    test "different users are counted independently" do +      limiter_name = :test_authenticated2 +      Config.put([:rate_limit, limiter_name], [{1, 10}, {1000, 5}]) +      Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) -      opts = RateLimiter.init(name: limiter_name) +      plug_opts = RateLimiter.init(name: limiter_name)        user = insert(:user)        conn = conn(:get, "/") |> assign(:user, user) @@ -214,19 +227,50 @@ defmodule Pleroma.Plugs.RateLimiterTest do        conn_2 = conn(:get, "/") |> assign(:user, user_2)        for i <- 1..5 do -        conn = RateLimiter.call(conn, opts) -        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, opts) +        conn = RateLimiter.call(conn, plug_opts) +        assert {^i, _} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)        end -      conn = RateLimiter.call(conn, opts) +      conn = RateLimiter.call(conn, plug_opts)        assert %{"error" => "Throttled"} = Phoenix.ConnTest.json_response(conn, :too_many_requests)        assert conn.halted -      conn_2 = RateLimiter.call(conn_2, opts) -      assert {1, 4} = RateLimiter.inspect_bucket(conn_2, limiter_name, opts) +      conn_2 = RateLimiter.call(conn_2, plug_opts) +      assert {1, 4} = RateLimiter.inspect_bucket(conn_2, limiter_name, plug_opts)        refute conn_2.status == Plug.Conn.Status.code(:too_many_requests)        refute conn_2.resp_body        refute conn_2.halted      end    end + +  test "doesn't crash due to a race condition when multiple requests are made at the same time and the bucket is not yet initialized" do +    limiter_name = :test_race_condition +    Pleroma.Config.put([:rate_limit, limiter_name], {1000, 5}) +    Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + +    opts = RateLimiter.init(name: limiter_name) + +    conn = conn(:get, "/") +    conn_2 = conn(:get, "/") + +    %Task{pid: pid1} = +      task1 = +      Task.async(fn -> +        receive do +          :process2_up -> +            RateLimiter.call(conn, opts) +        end +      end) + +    task2 = +      Task.async(fn -> +        send(pid1, :process2_up) +        RateLimiter.call(conn_2, opts) +      end) + +    Task.await(task1) +    Task.await(task2) + +    refute {:err, :not_found} == RateLimiter.inspect_bucket(conn, limiter_name, opts) +  end  end diff --git a/test/plugs/remote_ip_test.exs b/test/plugs/remote_ip_test.exs index 93e276454..9c3737b0b 100644 --- a/test/plugs/remote_ip_test.exs +++ b/test/plugs/remote_ip_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Plugs.RemoteIpTest do diff --git a/test/plugs/user_enabled_plug_test.exs b/test/plugs/user_enabled_plug_test.exs index b6f297552..931513d83 100644 --- a/test/plugs/user_enabled_plug_test.exs +++ b/test/plugs/user_enabled_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Plugs.UserEnabledPlugTest do diff --git a/test/plugs/user_is_admin_plug_test.exs b/test/plugs/user_is_admin_plug_test.exs index bc6fcd73c..015d51018 100644 --- a/test/plugs/user_is_admin_plug_test.exs +++ b/test/plugs/user_is_admin_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Plugs.UserIsAdminPlugTest do diff --git a/test/repo_test.exs b/test/repo_test.exs index 2224a6b2b..75e85f974 100644 --- a/test/repo_test.exs +++ b/test/repo_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.RepoTest do diff --git a/test/runtime_test.exs b/test/runtime_test.exs index 6bde608ae..a1a6c57cd 100644 --- a/test/runtime_test.exs +++ b/test/runtime_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.RuntimeTest do diff --git a/test/scheduled_activity_test.exs b/test/scheduled_activity_test.exs index 6c13d300a..4369e7e8a 100644 --- a/test/scheduled_activity_test.exs +++ b/test/scheduled_activity_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.ScheduledActivityTest do diff --git a/test/stat_test.exs b/test/stat_test.exs index 1f0c6199a..33b77e7e7 100644 --- a/test/stat_test.exs +++ b/test/stat_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.StateTest do diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index 4a4585844..d63a0f06b 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-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ChannelCase do diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 22e72fc09..0f2e81f9e 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-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ConnCase do diff --git a/test/support/factory.ex b/test/support/factory.ex index 780235cb9..af639b6cd 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Factory do diff --git a/test/support/helpers.ex b/test/support/helpers.ex index db2f08c81..6bf4b019e 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 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 ba3341327..d46887865 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-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule HttpRequestMock do diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex index 0e3b654df..e96994c57 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-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Tests.ObanHelpers do diff --git a/test/tasks/config_test.exs b/test/tasks/config_test.exs index 2f9405550..a6c0de351 100644 --- a/test/tasks/config_test.exs +++ b/test/tasks/config_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Mix.Tasks.Pleroma.ConfigTest do diff --git a/test/tasks/instance_test.exs b/test/tasks/instance_test.exs index 61f5833fc..f6a4ba508 100644 --- a/test/tasks/instance_test.exs +++ b/test/tasks/instance_test.exs @@ -1,12 +1,11 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.InstanceTest do    use ExUnit.Case    setup do -    static_dir = Pleroma.Config.get([:instance, :static_dir])      File.mkdir_p!(tmp_path())      on_exit(fn -> diff --git a/test/tasks/refresh_counter_cache_test.exs b/test/tasks/refresh_counter_cache_test.exs index 47367af94..b63f44c08 100644 --- a/test/tasks/refresh_counter_cache_test.exs +++ b/test/tasks/refresh_counter_cache_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Mix.Tasks.Pleroma.RefreshCounterCacheTest do diff --git a/test/uploaders/local_test.exs b/test/uploaders/local_test.exs index 1963dac23..ae2cfef94 100644 --- a/test/uploaders/local_test.exs +++ b/test/uploaders/local_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Uploaders.LocalTest do diff --git a/test/uploaders/s3_test.exs b/test/uploaders/s3_test.exs index ab7795c3b..fdc7eff41 100644 --- a/test/uploaders/s3_test.exs +++ b/test/uploaders/s3_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Uploaders.S3Test do diff --git a/test/user_search_test.exs b/test/user_search_test.exs index fe52cc7a1..406cc8fb2 100644 --- a/test/user_search_test.exs +++ b/test/user_search_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.UserSearchTest do diff --git a/test/user_test.exs b/test/user_test.exs index 2fc42a90d..84d7f5727 100644 --- a/test/user_test.exs +++ b/test/user_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.UserTest do diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 9b7cfee63..3dd3dd04d 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.ActivityPubTest do @@ -8,6 +8,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    alias Pleroma.Activity    alias Pleroma.Builders.ActivityBuilder +  alias Pleroma.Config    alias Pleroma.Notification    alias Pleroma.Object    alias Pleroma.User @@ -15,6 +16,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    alias Pleroma.Web.ActivityPub.Utils    alias Pleroma.Web.AdminAPI.AccountView    alias Pleroma.Web.CommonAPI +  alias Pleroma.Web.Federator    import Pleroma.Factory    import Tesla.Mock @@ -224,7 +226,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    describe "insertion" do      test "drops activities beyond a certain limit" do -      limit = Pleroma.Config.get([:instance, :remote_limit]) +      limit = Config.get([:instance, :remote_limit])        random_text =          :crypto.strong_rand_bytes(limit + 1) @@ -385,6 +387,27 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    end    describe "create activities" do +    test "it reverts create" do +      user = insert(:user) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = +                 ActivityPub.create(%{ +                   to: ["user1", "user2"], +                   actor: user, +                   context: "", +                   object: %{ +                     "to" => ["user1", "user2"], +                     "type" => "Note", +                     "content" => "testing" +                   } +                 }) +      end + +      assert Repo.aggregate(Activity, :count, :id) == 0 +      assert Repo.aggregate(Object, :count, :id) == 0 +    end +      test "removes doubled 'to' recipients" do        user = insert(:user) @@ -852,8 +875,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    end    describe "react to an object" do -    test_with_mock "sends an activity to federation", Pleroma.Web.Federator, [:passthrough], [] do -      Pleroma.Config.put([:instance, :federating], true) +    test_with_mock "sends an activity to federation", Federator, [:passthrough], [] do +      Config.put([:instance, :federating], true)        user = insert(:user)        reactor = insert(:user)        {:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"}) @@ -861,7 +884,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "🔥") -      assert called(Pleroma.Web.Federator.publish(reaction_activity)) +      assert called(Federator.publish(reaction_activity))      end      test "adds an emoji reaction activity to the db" do @@ -899,11 +922,26 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do                 ["☕", [third_user.ap_id]]               ]      end + +    test "reverts emoji reaction on error" do +      [user, reactor] = insert_list(2, :user) + +      {:ok, activity} = CommonAPI.post(user, %{"status" => "Status"}) +      object = Object.normalize(activity) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.react_with_emoji(reactor, object, "😀") +      end + +      object = Object.get_by_ap_id(object.data["id"]) +      refute object.data["reaction_count"] +      refute object.data["reactions"] +    end    end    describe "unreacting to an object" do -    test_with_mock "sends an activity to federation", Pleroma.Web.Federator, [:passthrough], [] do -      Pleroma.Config.put([:instance, :federating], true) +    test_with_mock "sends an activity to federation", Federator, [:passthrough], [] do +      Config.put([:instance, :federating], true)        user = insert(:user)        reactor = insert(:user)        {:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"}) @@ -911,12 +949,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "🔥") -      assert called(Pleroma.Web.Federator.publish(reaction_activity)) +      assert called(Federator.publish(reaction_activity))        {:ok, unreaction_activity, _object} =          ActivityPub.unreact_with_emoji(reactor, reaction_activity.data["id"]) -      assert called(Pleroma.Web.Federator.publish(unreaction_activity)) +      assert called(Federator.publish(unreaction_activity))      end      test "adds an undo activity to the db" do @@ -937,18 +975,36 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        assert object.data["reaction_count"] == 0        assert object.data["reactions"] == []      end + +    test "reverts emoji unreact on error" do +      [user, reactor] = insert_list(2, :user) +      {:ok, activity} = CommonAPI.post(user, %{"status" => "Status"}) +      object = Object.normalize(activity) + +      {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "😀") + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = +                 ActivityPub.unreact_with_emoji(reactor, reaction_activity.data["id"]) +      end + +      object = Object.get_by_ap_id(object.data["id"]) + +      assert object.data["reaction_count"] == 1 +      assert object.data["reactions"] == [["😀", [reactor.ap_id]]] +    end    end    describe "like an object" do -    test_with_mock "sends an activity to federation", Pleroma.Web.Federator, [:passthrough], [] do -      Pleroma.Config.put([:instance, :federating], true) +    test_with_mock "sends an activity to federation", Federator, [:passthrough], [] do +      Config.put([:instance, :federating], true)        note_activity = insert(:note_activity)        assert object_activity = Object.normalize(note_activity)        user = insert(:user)        {:ok, like_activity, _object} = ActivityPub.like(user, object_activity) -      assert called(Pleroma.Web.Federator.publish(like_activity)) +      assert called(Federator.publish(like_activity))      end      test "returns exist activity if object already liked" do @@ -963,6 +1019,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        assert like_activity == like_activity_exist      end +    test "reverts like activity on error" do +      note_activity = insert(:note_activity) +      object = Object.normalize(note_activity) +      user = insert(:user) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.like(user, object) +      end + +      assert Repo.aggregate(Activity, :count, :id) == 1 +      assert Repo.get(Object, object.id) == object +    end +      test "adds a like activity to the db" do        note_activity = insert(:note_activity)        assert object = Object.normalize(note_activity) @@ -993,15 +1062,15 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    end    describe "unliking" do -    test_with_mock "sends an activity to federation", Pleroma.Web.Federator, [:passthrough], [] do -      Pleroma.Config.put([:instance, :federating], true) +    test_with_mock "sends an activity to federation", Federator, [:passthrough], [] do +      Config.put([:instance, :federating], true)        note_activity = insert(:note_activity)        object = Object.normalize(note_activity)        user = insert(:user)        {:ok, object} = ActivityPub.unlike(user, object) -      refute called(Pleroma.Web.Federator.publish()) +      refute called(Federator.publish())        {:ok, _like_activity, object} = ActivityPub.like(user, object)        assert object.data["like_count"] == 1 @@ -1009,7 +1078,24 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        {:ok, unlike_activity, _, object} = ActivityPub.unlike(user, object)        assert object.data["like_count"] == 0 -      assert called(Pleroma.Web.Federator.publish(unlike_activity)) +      assert called(Federator.publish(unlike_activity)) +    end + +    test "reverts unliking on error" do +      note_activity = insert(:note_activity) +      object = Object.normalize(note_activity) +      user = insert(:user) + +      {:ok, like_activity, object} = ActivityPub.like(user, object) +      assert object.data["like_count"] == 1 + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.unlike(user, object) +      end + +      assert Object.get_by_ap_id(object.data["id"]) == object +      assert object.data["like_count"] == 1 +      assert Activity.get_by_id(like_activity.id)      end      test "unliking a previously liked object" do @@ -1051,6 +1137,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        assert announce_activity.data["actor"] == user.ap_id        assert announce_activity.data["context"] == object.data["context"]      end + +    test "reverts annouce from object on error" do +      note_activity = insert(:note_activity) +      object = Object.normalize(note_activity) +      user = insert(:user) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.announce(user, object) +      end + +      reloaded_object = Object.get_by_ap_id(object.data["id"]) +      assert reloaded_object == object +      refute reloaded_object.data["announcement_count"] +      refute reloaded_object.data["announcements"] +    end    end    describe "announcing a private object" do @@ -1093,8 +1194,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        user = insert(:user)        # Unannouncing an object that is not announced does nothing -      # {:ok, object} = ActivityPub.unannounce(user, object) -      # assert object.data["announcement_count"] == 0 +      {:ok, object} = ActivityPub.unannounce(user, object) +      refute object.data["announcement_count"]        {:ok, announce_activity, object} = ActivityPub.announce(user, object)        assert object.data["announcement_count"] == 1 @@ -1114,6 +1215,22 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        assert Activity.get_by_id(announce_activity.id) == nil      end + +    test "reverts unannouncing on error" do +      note_activity = insert(:note_activity) +      object = Object.normalize(note_activity) +      user = insert(:user) + +      {:ok, _announce_activity, object} = ActivityPub.announce(user, object) +      assert object.data["announcement_count"] == 1 + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.unannounce(user, object) +      end + +      object = Object.get_by_ap_id(object.data["id"]) +      assert object.data["announcement_count"] == 1 +    end    end    describe "uploading files" do @@ -1148,6 +1265,35 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    end    describe "following / unfollowing" do +    test "it reverts follow activity" do +      follower = insert(:user) +      followed = insert(:user) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.follow(follower, followed) +      end + +      assert Repo.aggregate(Activity, :count, :id) == 0 +      assert Repo.aggregate(Object, :count, :id) == 0 +    end + +    test "it reverts unfollow activity" do +      follower = insert(:user) +      followed = insert(:user) + +      {:ok, follow_activity} = ActivityPub.follow(follower, followed) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.unfollow(follower, followed) +      end + +      activity = Activity.get_by_id(follow_activity.id) +      assert activity.data["type"] == "Follow" +      assert activity.data["actor"] == follower.ap_id + +      assert activity.data["object"] == followed.ap_id +    end +      test "creates a follow activity" do        follower = insert(:user)        followed = insert(:user) @@ -1194,6 +1340,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    end    describe "blocking / unblocking" do +    test "reverts block activity on error" do +      [blocker, blocked] = insert_list(2, :user) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.block(blocker, blocked) +      end + +      assert Repo.aggregate(Activity, :count, :id) == 0 +      assert Repo.aggregate(Object, :count, :id) == 0 +    end +      test "creates a block activity" do        blocker = insert(:user)        blocked = insert(:user) @@ -1205,6 +1362,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        assert activity.data["object"] == blocked.ap_id      end +    test "reverts unblock activity on error" do +      [blocker, blocked] = insert_list(2, :user) +      {:ok, block_activity} = ActivityPub.block(blocker, blocked) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.unblock(blocker, blocked) +      end + +      assert block_activity.data["type"] == "Block" +      assert block_activity.data["actor"] == blocker.ap_id + +      assert Repo.aggregate(Activity, :count, :id) == 1 +      assert Repo.aggregate(Object, :count, :id) == 1 +    end +      test "creates an undo activity for the last block" do        blocker = insert(:user)        blocked = insert(:user) @@ -1226,6 +1398,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    describe "deletion" do      clear_config([:instance, :rewrite_policy]) +    test "it reverts deletion on error" do +      note = insert(:note_activity) +      object = Object.normalize(note) + +      with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do +        assert {:error, :reverted} = ActivityPub.delete(object) +      end + +      assert Repo.aggregate(Activity, :count, :id) == 1 +      assert Repo.get(Object, object.id) == object +      assert Activity.get_by_id(note.id) == note +    end +      test "it creates a delete activity and deletes the original object" do        note = insert(:note_activity)        object = Object.normalize(note) @@ -1419,7 +1604,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do    end    test "returned pinned statuses" do -    Pleroma.Config.put([:instance, :max_pinned_statuses], 3) +    Config.put([:instance, :max_pinned_statuses], 3)      user = insert(:user)      {:ok, activity_one} = CommonAPI.post(user, %{"status" => "HI!!!"}) diff --git a/test/web/activity_pub/mrf/hellthread_policy_test.exs b/test/web/activity_pub/mrf/hellthread_policy_test.exs index a78752a12..916b95692 100644 --- a/test/web/activity_pub/mrf/hellthread_policy_test.exs +++ b/test/web/activity_pub/mrf/hellthread_policy_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do diff --git a/test/web/activity_pub/mrf/keyword_policy_test.exs b/test/web/activity_pub/mrf/keyword_policy_test.exs index d950ddd56..18242a889 100644 --- a/test/web/activity_pub/mrf/keyword_policy_test.exs +++ b/test/web/activity_pub/mrf/keyword_policy_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicyTest do diff --git a/test/web/activity_pub/mrf/mention_policy_test.exs b/test/web/activity_pub/mrf/mention_policy_test.exs index 93a55850f..08f7be542 100644 --- a/test/web/activity_pub/mrf/mention_policy_test.exs +++ b/test/web/activity_pub/mrf/mention_policy_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.MRF.MentionPolicyTest do diff --git a/test/web/activity_pub/mrf/subchain_policy_test.exs b/test/web/activity_pub/mrf/subchain_policy_test.exs index 29065f612..221b8958e 100644 --- a/test/web/activity_pub/mrf/subchain_policy_test.exs +++ b/test/web/activity_pub/mrf/subchain_policy_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicyTest do diff --git a/test/web/activity_pub/publisher_test.exs b/test/web/activity_pub/publisher_test.exs index 015af19ab..3404848d4 100644 --- a/test/web/activity_pub/publisher_test.exs +++ b/test/web/activity_pub/publisher_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.PublisherTest do diff --git a/test/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/web/activity_pub/transmogrifier/follow_handling_test.exs index fd771ac54..c3d3f9830 100644 --- a/test/web/activity_pub/transmogrifier/follow_handling_test.exs +++ b/test/web/activity_pub/transmogrifier/follow_handling_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 937f78cbe..efbca82f6 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do diff --git a/test/web/activity_pub/utils_test.exs b/test/web/activity_pub/utils_test.exs index 211fa6c95..e5ab54dd4 100644 --- a/test/web/activity_pub/utils_test.exs +++ b/test/web/activity_pub/utils_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.UtilsTest do diff --git a/test/web/activity_pub/views/object_view_test.exs b/test/web/activity_pub/views/object_view_test.exs index acc855b98..09866e99b 100644 --- a/test/web/activity_pub/views/object_view_test.exs +++ b/test/web/activity_pub/views/object_view_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.ActivityPub.ObjectViewTest do diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index 0b79e4c5c..45b22ea24 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do @@ -3065,6 +3065,52 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do      end    end +  describe "GET /api/pleroma/admin/statuses" do +    test "returns all public, unlisted, and direct statuses", %{conn: conn, admin: admin} do +      blocked = insert(:user) +      user = insert(:user) +      User.block(admin, blocked) + +      {:ok, _} = +        CommonAPI.post(user, %{"status" => "@#{admin.nickname}", "visibility" => "direct"}) + +      {:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "unlisted"}) +      {:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "private"}) +      {:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "public"}) +      {:ok, _} = CommonAPI.post(blocked, %{"status" => ".", "visibility" => "public"}) + +      response = +        conn +        |> get("/api/pleroma/admin/statuses") +        |> json_response(200) + +      refute "private" in Enum.map(response, & &1["visibility"]) +      assert length(response) == 4 +    end + +    test "returns only local statuses with local_only on", %{conn: conn} do +      user = insert(:user) +      remote_user = insert(:user, local: false, nickname: "archaeme@archae.me") +      insert(:note_activity, user: user, local: true) +      insert(:note_activity, user: remote_user, local: false) + +      response = +        conn +        |> get("/api/pleroma/admin/statuses?local_only=true") +        |> json_response(200) + +      assert length(response) == 1 +    end + +    test "returns private statuses with godmode on", %{conn: conn} do +      user = insert(:user) +      {:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "private"}) +      {:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "public"}) +      conn = get(conn, "/api/pleroma/admin/statuses?godmode=true") +      assert json_response(conn, 200) |> length() == 2 +    end +  end +    describe "GET /api/pleroma/admin/users/:nickname/statuses" do      setup do        user = insert(:user) @@ -3115,6 +3161,20 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do        assert json_response(conn, 200) |> length() == 5      end + +    test "excludes reblogs by default", %{conn: conn, user: user} do +      other_user = insert(:user) +      {:ok, activity} = CommonAPI.post(user, %{"status" => "."}) +      {:ok, %Activity{}, _} = CommonAPI.repeat(activity.id, other_user) + +      conn_res = get(conn, "/api/pleroma/admin/users/#{other_user.nickname}/statuses") +      assert json_response(conn_res, 200) |> length() == 0 + +      conn_res = +        get(conn, "/api/pleroma/admin/users/#{other_user.nickname}/statuses?with_reblogs=true") + +      assert json_response(conn_res, 200) |> length() == 1 +    end    end    describe "GET /api/pleroma/admin/moderation_log" do @@ -3397,7 +3457,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do        user = insert(:user, local: false, nickname: "archaeme@archae.me")        user2 = insert(:user, local: false, nickname: "test@test.com")        insert_pair(:note_activity, user: user) -      insert(:note_activity, user: user2) +      activity = insert(:note_activity, user: user2)        ret_conn = get(conn, "/api/pleroma/admin/instances/archae.me/statuses") @@ -3416,6 +3476,16 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do        response = json_response(ret_conn, 200)        assert Enum.empty?(response) + +      CommonAPI.repeat(activity.id, user) + +      ret_conn = get(conn, "/api/pleroma/admin/instances/archae.me/statuses") +      response = json_response(ret_conn, 200) +      assert length(response) == 2 + +      ret_conn = get(conn, "/api/pleroma/admin/instances/archae.me/statuses?with_reblogs=true") +      response = json_response(ret_conn, 200) +      assert length(response) == 3      end    end diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 601c32954..299d968db 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.CommonAPITest do diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs index 848300ef3..b380d10d8 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/web/common_api/common_api_utils_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.CommonAPI.UtilsTest do diff --git a/test/web/feed/tag_controller_test.exs b/test/web/feed/tag_controller_test.exs index 2aa1b9587..5950605e8 100644 --- a/test/web/feed/tag_controller_test.exs +++ b/test/web/feed/tag_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Feed.TagControllerTest do diff --git a/test/web/feed/user_controller_test.exs b/test/web/feed/user_controller_test.exs index 41cc9e07e..19a019060 100644 --- a/test/web/feed/user_controller_test.exs +++ b/test/web/feed/user_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Feed.UserControllerTest do diff --git a/test/web/masto_fe_controller_test.exs b/test/web/masto_fe_controller_test.exs index f9870a852..9a2d76e0b 100644 --- a/test/web/masto_fe_controller_test.exs +++ b/test/web/masto_fe_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.MastoFEController do diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs index 82d9e7d2f..cba68859e 100644 --- a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs +++ b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/web/mastodon_api/controllers/account_controller_test.exs index 8625bb9cf..57d0f4416 100644 --- a/test/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/web/mastodon_api/controllers/account_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do @@ -673,10 +673,48 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do        assert json_response(res, 400) == %{"error" => "{\"email\":[\"has already been taken\"]}"}      end -    clear_config([Pleroma.Plugs.RemoteIp, :enabled]) +    test "returns bad_request if missing required params", %{ +      conn: conn, +      valid_params: valid_params +    } do +      app_token = insert(:oauth_token, user: nil) -    test "rate limit", %{conn: conn} do +      conn = put_req_header(conn, "authorization", "Bearer " <> app_token.token) + +      res = post(conn, "/api/v1/accounts", valid_params) +      assert json_response(res, 200) + +      [{127, 0, 0, 1}, {127, 0, 0, 2}, {127, 0, 0, 3}, {127, 0, 0, 4}] +      |> Stream.zip(valid_params) +      |> Enum.each(fn {ip, {attr, _}} -> +        res = +          conn +          |> Map.put(:remote_ip, ip) +          |> post("/api/v1/accounts", Map.delete(valid_params, attr)) +          |> json_response(400) + +        assert res == %{"error" => "Missing parameters"} +      end) +    end + +    test "returns forbidden if token is invalid", %{conn: conn, valid_params: valid_params} do +      conn = put_req_header(conn, "authorization", "Bearer " <> "invalid-token") + +      res = post(conn, "/api/v1/accounts", valid_params) +      assert json_response(res, 403) == %{"error" => "Invalid credentials"} +    end +  end + +  describe "create account by app / rate limit" do +    clear_config([Pleroma.Plugs.RemoteIp, :enabled]) do        Pleroma.Config.put([Pleroma.Plugs.RemoteIp, :enabled], true) +    end + +    clear_config([:rate_limit, :app_account_creation]) do +      Pleroma.Config.put([:rate_limit, :app_account_creation], {10_000, 2}) +    end + +    test "respects rate limit setting", %{conn: conn} do        app_token = insert(:oauth_token, user: nil)        conn = @@ -684,7 +722,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do          |> put_req_header("authorization", "Bearer " <> app_token.token)          |> Map.put(:remote_ip, {15, 15, 15, 15}) -      for i <- 1..5 do +      for i <- 1..2 do          conn =            post(conn, "/api/v1/accounts", %{              username: "#{i}lain", @@ -718,37 +756,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do        assert json_response(conn, :too_many_requests) == %{"error" => "Throttled"}      end - -    test "returns bad_request if missing required params", %{ -      conn: conn, -      valid_params: valid_params -    } do -      app_token = insert(:oauth_token, user: nil) - -      conn = put_req_header(conn, "authorization", "Bearer " <> app_token.token) - -      res = post(conn, "/api/v1/accounts", valid_params) -      assert json_response(res, 200) - -      [{127, 0, 0, 1}, {127, 0, 0, 2}, {127, 0, 0, 3}, {127, 0, 0, 4}] -      |> Stream.zip(valid_params) -      |> Enum.each(fn {ip, {attr, _}} -> -        res = -          conn -          |> Map.put(:remote_ip, ip) -          |> post("/api/v1/accounts", Map.delete(valid_params, attr)) -          |> json_response(400) - -        assert res == %{"error" => "Missing parameters"} -      end) -    end - -    test "returns forbidden if token is invalid", %{conn: conn, valid_params: valid_params} do -      conn = put_req_header(conn, "authorization", "Bearer " <> "invalid-token") - -      res = post(conn, "/api/v1/accounts", valid_params) -      assert json_response(res, 403) == %{"error" => "Invalid credentials"} -    end    end    describe "GET /api/v1/accounts/:id/lists - account_lists" do diff --git a/test/web/mastodon_api/controllers/conversation_controller_test.exs b/test/web/mastodon_api/controllers/conversation_controller_test.exs index 4bb9781a6..801b0259b 100644 --- a/test/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/web/mastodon_api/controllers/conversation_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do diff --git a/test/web/mastodon_api/controllers/domain_block_controller_test.exs b/test/web/mastodon_api/controllers/domain_block_controller_test.exs index 55de625ba..8d24b3b88 100644 --- a/test/web/mastodon_api/controllers/domain_block_controller_test.exs +++ b/test/web/mastodon_api/controllers/domain_block_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.DomainBlockControllerTest do diff --git a/test/web/mastodon_api/controllers/filter_controller_test.exs b/test/web/mastodon_api/controllers/filter_controller_test.exs index 3aea17ec7..97ab005e0 100644 --- a/test/web/mastodon_api/controllers/filter_controller_test.exs +++ b/test/web/mastodon_api/controllers/filter_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do diff --git a/test/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/web/mastodon_api/controllers/follow_request_controller_test.exs index 6e4a76501..dd848821a 100644 --- a/test/web/mastodon_api/controllers/follow_request_controller_test.exs +++ b/test/web/mastodon_api/controllers/follow_request_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do diff --git a/test/web/mastodon_api/controllers/list_controller_test.exs b/test/web/mastodon_api/controllers/list_controller_test.exs index a6effbb69..c9c4cbb49 100644 --- a/test/web/mastodon_api/controllers/list_controller_test.exs +++ b/test/web/mastodon_api/controllers/list_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.ListControllerTest do diff --git a/test/web/mastodon_api/controllers/media_controller_test.exs b/test/web/mastodon_api/controllers/media_controller_test.exs index 042511ca4..203fa73b0 100644 --- a/test/web/mastodon_api/controllers/media_controller_test.exs +++ b/test/web/mastodon_api/controllers/media_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs index 6f0606250..d452ddbdd 100644 --- a/test/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/web/mastodon_api/controllers/notification_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do diff --git a/test/web/mastodon_api/controllers/poll_controller_test.exs b/test/web/mastodon_api/controllers/poll_controller_test.exs index 5a1cea11b..88b13a25a 100644 --- a/test/web/mastodon_api/controllers/poll_controller_test.exs +++ b/test/web/mastodon_api/controllers/poll_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.PollControllerTest do diff --git a/test/web/mastodon_api/controllers/report_controller_test.exs b/test/web/mastodon_api/controllers/report_controller_test.exs index 53c132ff4..1361b1420 100644 --- a/test/web/mastodon_api/controllers/report_controller_test.exs +++ b/test/web/mastodon_api/controllers/report_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.ReportControllerTest do diff --git a/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs b/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs index 6317d1b47..3cd08c189 100644 --- a/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs +++ b/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do diff --git a/test/web/mastodon_api/controllers/search_controller_test.exs b/test/web/mastodon_api/controllers/search_controller_test.exs index effae130c..11133ff66 100644 --- a/test/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/web/mastodon_api/controllers/search_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index 781c3f7dc..9c2ceda5d 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do diff --git a/test/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/web/mastodon_api/controllers/suggestion_controller_test.exs index 0319d3475..c697a39f8 100644 --- a/test/web/mastodon_api/controllers/suggestion_controller_test.exs +++ b/test/web/mastodon_api/controllers/suggestion_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs index bb94d8e5a..2c03b0a75 100644 --- a/test/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index c1f70f9fe..75f184242 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 00c294845..d60ed7b64 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.AccountViewTest do diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs index 2ac75c2ff..4df9c3c03 100644 --- a/test/web/mastodon_api/views/notification_view_test.exs +++ b/test/web/mastodon_api/views/notification_view_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs index 560f8179f..191895c6f 100644 --- a/test/web/mastodon_api/views/status_view_test.exs +++ b/test/web/mastodon_api/views/status_view_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MastodonAPI.StatusViewTest do diff --git a/test/web/media_proxy/media_proxy_controller_test.exs b/test/web/media_proxy/media_proxy_controller_test.exs index 8c0c2a0e2..f035dfeee 100644 --- a/test/web/media_proxy/media_proxy_controller_test.exs +++ b/test/web/media_proxy/media_proxy_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do diff --git a/test/web/media_proxy/media_proxy_test.exs b/test/web/media_proxy/media_proxy_test.exs index 2be5c9de0..8f5fcf2eb 100644 --- a/test/web/media_proxy/media_proxy_test.exs +++ b/test/web/media_proxy/media_proxy_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.MediaProxyTest do diff --git a/test/web/metadata/opengraph_test.exs b/test/web/metadata/opengraph_test.exs index 0d47b1cb8..9d7c009eb 100644 --- a/test/web/metadata/opengraph_test.exs +++ b/test/web/metadata/opengraph_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do diff --git a/test/web/metadata/twitter_card_test.exs b/test/web/metadata/twitter_card_test.exs index faf347cc6..3d75d1ed5 100644 --- a/test/web/metadata/twitter_card_test.exs +++ b/test/web/metadata/twitter_card_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do diff --git a/test/web/metadata/utils_test.exs b/test/web/metadata/utils_test.exs index 7547f2932..8183256d8 100644 --- a/test/web/metadata/utils_test.exs +++ b/test/web/metadata/utils_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Metadata.UtilsTest do diff --git a/test/web/node_info_test.exs b/test/web/node_info_test.exs index d1d7a3ce8..ee10ad5db 100644 --- a/test/web/node_info_test.exs +++ b/test/web/node_info_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.NodeInfoTest do diff --git a/test/web/oauth/app_test.exs b/test/web/oauth/app_test.exs index 195b8c17f..899af648e 100644 --- a/test/web/oauth/app_test.exs +++ b/test/web/oauth/app_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.OAuth.AppTest do diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs index 89fcf8c36..cff469c28 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.OAuth.OAuthControllerTest do diff --git a/test/web/pleroma_api/controllers/account_controller_test.exs b/test/web/pleroma_api/controllers/account_controller_test.exs index d17026a6b..245cc1579 100644 --- a/test/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/web/pleroma_api/controllers/account_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do diff --git a/test/web/pleroma_api/controllers/emoji_api_controller_test.exs b/test/web/pleroma_api/controllers/emoji_api_controller_test.exs index 6f1ea78ec..4b9f5cf9a 100644 --- a/test/web/pleroma_api/controllers/emoji_api_controller_test.exs +++ b/test/web/pleroma_api/controllers/emoji_api_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do diff --git a/test/web/pleroma_api/controllers/mascot_controller_test.exs b/test/web/pleroma_api/controllers/mascot_controller_test.exs index 40c33e609..617831b02 100644 --- a/test/web/pleroma_api/controllers/mascot_controller_test.exs +++ b/test/web/pleroma_api/controllers/mascot_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.PleromaAPI.MascotControllerTest do diff --git a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs index 164cfa695..32250f06f 100644 --- a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs +++ b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do diff --git a/test/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/web/pleroma_api/controllers/scrobble_controller_test.exs index 2242610f1..1b945040c 100644 --- a/test/web/pleroma_api/controllers/scrobble_controller_test.exs +++ b/test/web/pleroma_api/controllers/scrobble_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do diff --git a/test/web/plugs/federating_plug_test.exs b/test/web/plugs/federating_plug_test.exs index c26b487d9..13edc4359 100644 --- a/test/web/plugs/federating_plug_test.exs +++ b/test/web/plugs/federating_plug_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.FederatingPlugTest do diff --git a/test/web/push/impl_test.exs b/test/web/push/impl_test.exs index acae7a734..089d55577 100644 --- a/test/web/push/impl_test.exs +++ b/test/web/push/impl_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.Push.ImplTest do @@ -98,6 +98,14 @@ defmodule Pleroma.Web.Push.ImplTest do      refute Pleroma.Repo.get(Subscription, subscription.id)    end +  test "deletes subscription when token has been deleted" do +    subscription = insert(:push_subscription) + +    Pleroma.Repo.delete(subscription.token) + +    refute Pleroma.Repo.get(Subscription, subscription.id) +  end +    test "renders title and body for create activity" do      user = insert(:user, nickname: "Bob") diff --git a/test/web/rich_media/parsers/twitter_card_test.exs b/test/web/rich_media/parsers/twitter_card_test.exs index f2ebbde7e..87c767c15 100644 --- a/test/web/rich_media/parsers/twitter_card_test.exs +++ b/test/web/rich_media/parsers/twitter_card_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.RichMedia.Parsers.TwitterCardTest do diff --git a/test/web/streamer/streamer_test.exs b/test/web/streamer/streamer_test.exs index 1cf20f1c2..339f99bbf 100644 --- a/test/web/streamer/streamer_test.exs +++ b/test/web/streamer/streamer_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.StreamerTest do diff --git a/test/web/twitter_api/password_controller_test.exs b/test/web/twitter_api/password_controller_test.exs index 29ba7d265..0a24860d3 100644 --- a/test/web/twitter_api/password_controller_test.exs +++ b/test/web/twitter_api/password_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 7650238f2..14eed5f27 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index 56633ffce..d464ce215 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/web/twitter_api/util_controller_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do diff --git a/test/workers/cron/clear_oauth_token_worker_test.exs b/test/workers/cron/clear_oauth_token_worker_test.exs index adea47326..f056b1a3e 100644 --- a/test/workers/cron/clear_oauth_token_worker_test.exs +++ b/test/workers/cron/clear_oauth_token_worker_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Workers.Cron.ClearOauthTokenWorkerTest do diff --git a/test/workers/cron/digest_emails_worker_test.exs b/test/workers/cron/digest_emails_worker_test.exs index 073615d9e..66e16b810 100644 --- a/test/workers/cron/digest_emails_worker_test.exs +++ b/test/workers/cron/digest_emails_worker_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Workers.Cron.DigestEmailsWorkerTest do diff --git a/test/workers/cron/purge_expired_activities_worker_test.exs b/test/workers/cron/purge_expired_activities_worker_test.exs index c2561683e..56c5aa409 100644 --- a/test/workers/cron/purge_expired_activities_worker_test.exs +++ b/test/workers/cron/purge_expired_activities_worker_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorkerTest do diff --git a/test/workers/scheduled_activity_worker_test.exs b/test/workers/scheduled_activity_worker_test.exs index 1405d7142..ab9f9c125 100644 --- a/test/workers/scheduled_activity_worker_test.exs +++ b/test/workers/scheduled_activity_worker_test.exs @@ -1,5 +1,5 @@  # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>  # SPDX-License-Identifier: AGPL-3.0-only  defmodule Pleroma.Workers.ScheduledActivityWorkerTest do  | 
