From 0a1527c008094a363e8d92ce1725d36c71bcc247 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 10 Jan 2022 17:50:39 +0300 Subject: [PATCH 1/2] Escape unicode RTL overrides in rich media parser tests Elixir 1.13 does not allow them in raw form anymore, resulting in errors like this when running the test: == Compilation error in file test/pleroma/web/rich_media/parser_test.exs == ** (SyntaxError) test/pleroma/web/rich_media/parser_test.exs:136:45: invalid bidirectional formatting character in string: \u202C. If you want to use such character, use it in its escaped \u202C form instead --- test/pleroma/web/rich_media/parser_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pleroma/web/rich_media/parser_test.exs b/test/pleroma/web/rich_media/parser_test.exs index 2f363b012..2fe7f1b0b 100644 --- a/test/pleroma/web/rich_media/parser_test.exs +++ b/test/pleroma/web/rich_media/parser_test.exs @@ -133,13 +133,13 @@ test "parses OEmbed" do assert Parser.parse("http://example.com/oembed") == {:ok, %{ - "author_name" => "‮‭‬bees‬", + "author_name" => "\u202E\u202D\u202Cbees\u202C", "author_url" => "https://www.flickr.com/photos/bees/", "cache_age" => 3600, "flickr_type" => "photo", "height" => "768", "html" => - "\"Bacon", + "\"Bacon", "license" => "All Rights Reserved", "license_id" => 0, "provider_name" => "Flickr", From a4b8a1150e4ee984293e1be2849fd1b0c8286f67 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 24 Jan 2022 19:03:10 +0100 Subject: [PATCH 2/2] Fix tests matching on "warn" Moving it to "warning" would break tests on 1.12.x --- test/pleroma/reverse_proxy_test.exs | 2 +- test/pleroma/web/common_api/utils_test.exs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index a4dd8e99a..49ddf251d 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -130,7 +130,7 @@ test "max_body_length returns error if streaming body more than that option", %{ assert capture_log(fn -> ReverseProxy.call(conn, "/stream-bytes/50", max_body_length: 30) end) =~ - "[warn] Elixir.Pleroma.ReverseProxy request to /stream-bytes/50 failed while reading/chunking: :body_too_large" + "Elixir.Pleroma.ReverseProxy request to /stream-bytes/50 failed while reading/chunking: :body_too_large" end end diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index fc01f820a..7063b2503 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -309,7 +309,7 @@ test "when date is a binary in wrong format" do assert capture_log(fn -> assert Utils.date_to_asctime(date) == expected - end) =~ "[warn] Date #{date} in wrong format, must be ISO 8601" + end) =~ "Date #{date} in wrong format, must be ISO 8601" end test "when date is a Unix timestamp" do @@ -319,7 +319,7 @@ test "when date is a Unix timestamp" do assert capture_log(fn -> assert Utils.date_to_asctime(date) == expected - end) =~ "[warn] Date #{date} in wrong format, must be ISO 8601" + end) =~ "Date #{date} in wrong format, must be ISO 8601" end test "when date is nil" do @@ -327,13 +327,13 @@ test "when date is nil" do assert capture_log(fn -> assert Utils.date_to_asctime(nil) == expected - end) =~ "[warn] Date in wrong format, must be ISO 8601" + end) =~ "Date in wrong format, must be ISO 8601" end test "when date is a random string" do assert capture_log(fn -> assert Utils.date_to_asctime("foo") == "" - end) =~ "[warn] Date foo in wrong format, must be ISO 8601" + end) =~ "Date foo in wrong format, must be ISO 8601" end end