summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2023-01-03 14:59:14 -0500
committerLain Soykaf <lain@lain.com>2023-01-03 14:59:14 -0500
commit72b3ec35f898b5eb2e69affee9c9569a8c2e0a0a (patch)
tree9c057c60e2139c1bd5d20b0edafae3bd5e6861b9 /test
parenta0cdc4cf9e6ff7857bc8a9dce029cf5103be9831 (diff)
downloadpleroma-72b3ec35f898b5eb2e69affee9c9569a8c2e0a0a.tar.gz
pleroma-72b3ec35f898b5eb2e69affee9c9569a8c2e0a0a.zip
Fix warnings in tests, treat warnings as errors in CI.
The warnings revealed two bad tests, the code still worked but the test didn't actually test for it. Activating this for CI to prevent issues like these in the future.
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/user/import_test.exs1
-rw-r--r--test/pleroma/user_search_test.exs1
-rw-r--r--test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs2
-rw-r--r--test/pleroma/web/mastodon_api/update_credentials_test.exs4
-rw-r--r--test/test_helper.exs1
5 files changed, 5 insertions, 4 deletions
diff --git a/test/pleroma/user/import_test.exs b/test/pleroma/user/import_test.exs
index b4efd4bb0..f75305e0e 100644
--- a/test/pleroma/user/import_test.exs
+++ b/test/pleroma/user/import_test.exs
@@ -3,7 +3,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.User.ImportTest do
- alias Pleroma.Repo
alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
diff --git a/test/pleroma/user_search_test.exs b/test/pleroma/user_search_test.exs
index 1deab6888..1af9a1493 100644
--- a/test/pleroma/user_search_test.exs
+++ b/test/pleroma/user_search_test.exs
@@ -3,7 +3,6 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.UserSearchTest do
- alias Pleroma.Repo
alias Pleroma.User
use Pleroma.DataCase
diff --git a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
index 9d99df27c..83bf59c6f 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
@@ -65,7 +65,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do
object = Object.get_by_ap_id(data["object"])
assert object.data["reaction_count"] == 1
- assert match?([[emoji, _]], object.data["reactions"])
+ assert match?([[^emoji, _]], object.data["reactions"])
end
test "it reject invalid emoji reactions" do
diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs
index d5fac7e25..d4004bcb6 100644
--- a/test/pleroma/web/mastodon_api/update_credentials_test.exs
+++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs
@@ -375,7 +375,9 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
"pleroma_background_image" => new_background_oversized
})
- assert user_response = json_response_and_validate_schema(res, 413)
+ assert %{"error" => "File is too large"} == json_response_and_validate_schema(res, 413)
+
+ user = Repo.get(User, user.id)
assert user.background == %{}
clear_config([:instance, :upload_limit], upload_limit)
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 60a61484f..046517b28 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -1,6 +1,7 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
+Code.put_compiler_option(:warnings_as_errors, true)
os_exclude = if :os.type() == {:unix, :darwin}, do: [skip_on_mac: true], else: []
ExUnit.start(exclude: [:federated, :erratic] ++ os_exclude)