From 2dff37604192b086ede4a00d68b886dbec93f3c9 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 25 May 2020 13:48:47 +0200 Subject: [PATCH 1/2] StealEmojiPolicyTest: Fix flaky test. --- test/web/activity_pub/mrf/steal_emoji_policy_test.exs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/web/activity_pub/mrf/steal_emoji_policy_test.exs index 8882c8c13..0e7e57c77 100644 --- a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/web/activity_pub/mrf/steal_emoji_policy_test.exs @@ -14,8 +14,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do end setup do - clear_config(:mrf_steal_emoji) - emoji_path = Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") File.rm_rf!(emoji_path) File.mkdir!(emoji_path) @@ -53,8 +51,8 @@ test "Steals emoji on unknown shortcode from allowed remote host" do } } - Config.put([:mrf_steal_emoji, :hosts], ["example.org"]) - Config.put([:mrf_steal_emoji, :size_limit], 284_468) + clear_config([:mrf_steal_emoji, :hosts], ["example.org"]) + clear_config([:mrf_steal_emoji, :size_limit], 284_468) assert {:ok, message} == StealEmojiPolicy.filter(message) From 5d5db7e5b7f722f7735798f9b9ed8069091726de Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 25 May 2020 14:00:18 +0200 Subject: [PATCH 2/2] StealEmojiPolicyTest: Clean up. --- test/web/activity_pub/mrf/steal_emoji_policy_test.exs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/web/activity_pub/mrf/steal_emoji_policy_test.exs index 0e7e57c77..3f8222736 100644 --- a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/web/activity_pub/mrf/steal_emoji_policy_test.exs @@ -19,6 +19,12 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do File.mkdir!(emoji_path) Pleroma.Emoji.reload() + + on_exit(fn -> + File.rm_rf!(emoji_path) + end) + + :ok end test "does nothing by default" do