diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-07-21 16:25:45 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2020-07-21 16:25:45 -0500 |
commit | 97c60b6a4308b77d0e4956b83a16b88292b62e37 (patch) | |
tree | db496d0f94e00b199be95ee285174f378f512daa /test | |
parent | 7ce722ce3e3dbc633324ff0ccaeddc467397ac5e (diff) | |
parent | 2b5d9eb10529325aef1b4aab980bd901ba6b0c70 (diff) | |
download | pleroma-97c60b6a4308b77d0e4956b83a16b88292b62e37.tar.gz pleroma-97c60b6a4308b77d0e4956b83a16b88292b62e37.zip |
Merge branch 'develop' into fix/pleroma-api-emoji-packs
Diffstat (limited to 'test')
-rw-r--r-- | test/formatter_test.exs | 30 | ||||
-rw-r--r-- | test/upload/filter/anonymize_filename_test.exs | 2 | ||||
-rw-r--r-- | test/uploaders/local_test.exs | 2 |
3 files changed, 34 insertions, 0 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs index bef5a2c28..8713ab9c2 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -255,6 +255,36 @@ defmodule Pleroma.FormatterTest do assert {_text, ^expected_mentions, []} = Formatter.linkify(text) end + + test "it parses URL containing local mention" do + _user = insert(:user, %{nickname: "lain"}) + + text = "https://example.com/@lain" + + expected = ~S(<a href="https://example.com/@lain" rel="ugc">https://example.com/@lain</a>) + + assert {^expected, [], []} = Formatter.linkify(text) + end + + test "it correctly parses angry face D:< with mention" do + lain = + insert(:user, %{ + nickname: "lain@lain.com", + ap_id: "https://lain.com/users/lain", + id: "9qrWmR0cKniB0YU0TA" + }) + + text = "@lain@lain.com D:<" + + expected_text = + ~S(<span class="h-card"><a class="u-url mention" data-user="9qrWmR0cKniB0YU0TA" href="https://lain.com/users/lain" rel="ugc">@<span>lain</span></a></span> D:<) + + expected_mentions = [ + {"@lain@lain.com", lain} + ] + + assert {^expected_text, ^expected_mentions, []} = Formatter.linkify(text) + end end describe ".parse_tags" do diff --git a/test/upload/filter/anonymize_filename_test.exs b/test/upload/filter/anonymize_filename_test.exs index 2d5c580f1..adff70f57 100644 --- a/test/upload/filter/anonymize_filename_test.exs +++ b/test/upload/filter/anonymize_filename_test.exs @@ -9,6 +9,8 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do alias Pleroma.Upload setup do + File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") + upload_file = %Upload{ name: "an… image.jpg", content_type: "image/jpg", diff --git a/test/uploaders/local_test.exs b/test/uploaders/local_test.exs index ae2cfef94..18122ff6c 100644 --- a/test/uploaders/local_test.exs +++ b/test/uploaders/local_test.exs @@ -14,6 +14,7 @@ defmodule Pleroma.Uploaders.LocalTest do describe "put_file/1" do test "put file to local folder" do + File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file_path = "local_upload/files/image.jpg" file = %Pleroma.Upload{ @@ -32,6 +33,7 @@ defmodule Pleroma.Uploaders.LocalTest do describe "delete_file/1" do test "deletes local file" do + File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file_path = "local_upload/files/image.jpg" file = %Pleroma.Upload{ |