From f4bbe78bd5411c36e80681d6ebf9fd35556cd16e Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 13 May 2023 11:19:23 -0600 Subject: [PATCH] Fix tests after mentions change --- tests/activities/models/test_post.py | 29 ++++++++++++++-------------- tests/api/test_statuses.py | 4 ++-- tests/core/test_html.py | 8 +++++--- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/activities/models/test_post.py b/tests/activities/models/test_post.py index e1d9fae..3b28b14 100644 --- a/tests/activities/models/test_post.py +++ b/tests/activities/models/test_post.py @@ -101,7 +101,7 @@ def test_linkify_mentions_remote( post.mentions.add(remote_identity) assert ( post.safe_content_remote() - == '

Hello @test

' + == '

Hello @test

' ) # Test a full username (local) post = Post.objects.create( @@ -112,7 +112,7 @@ def test_linkify_mentions_remote( post.mentions.add(identity) assert ( post.safe_content_remote() - == '

@test, welcome!

' + == '

@test, welcome!

' ) # Test that they don't get touched without a mention post = Post.objects.create( @@ -131,7 +131,7 @@ def test_linkify_mentions_remote( post.mentions.add(remote_identity) assert ( post.safe_content_remote() - == '

Hey @TeSt

' + == '

Hey @TeSt

' ) # Test trailing dot (remote) @@ -143,7 +143,7 @@ def test_linkify_mentions_remote( post.mentions.add(remote_identity) assert ( post.safe_content_remote() - == '

Hey @test.

' + == '

Hey @test.

' ) # Test that collapsing only applies to the first unique, short username @@ -154,15 +154,15 @@ def test_linkify_mentions_remote( ) post.mentions.set([remote_identity, remote_identity2]) assert post.safe_content_remote() == ( - '

Hey @TeSt ' - 'and @test@remote2.test

' + '

Hey @TeSt ' + 'and @test@remote2.test

' ) post.content = "

Hey @TeSt, @Test@remote.test and @test

" assert post.safe_content_remote() == ( - '

Hey @TeSt, ' - '@Test@remote.test ' - 'and @test

' + '

Hey @TeSt, ' + '@Test@remote.test ' + 'and @test

' ) @@ -180,7 +180,7 @@ def test_linkify_mentions_local(config_system, identity, identity2, remote_ident post.mentions.add(remote_identity) assert ( post.safe_content_local() - == '

Hello @test

' + == '

Hello @test

' ) # Test a full username (local) post = Post.objects.create( @@ -191,9 +191,9 @@ def test_linkify_mentions_local(config_system, identity, identity2, remote_ident post.mentions.add(identity) post.mentions.add(identity2) assert post.safe_content_local() == ( - '

@test, welcome!' - ' @test@example2.com' - ' @test

' + '

@test, welcome!' + ' @test@example2.com' + ' @test

' ) # Test a full username (remote) with no

post = Post.objects.create( @@ -204,7 +204,7 @@ def test_linkify_mentions_local(config_system, identity, identity2, remote_ident post.mentions.add(remote_identity) assert ( post.safe_content_local() - == '@test hello!' + == '@test hello!' ) # Test that they don't get touched without a mention post = Post.objects.create( @@ -217,7 +217,6 @@ def test_linkify_mentions_local(config_system, identity, identity2, remote_ident @pytest.mark.django_db def test_post_transitions(identity, stator): - # Create post post = Post.objects.create( content="

Hello!

", diff --git a/tests/api/test_statuses.py b/tests/api/test_statuses.py index e46d8a5..3b763df 100644 --- a/tests/api/test_statuses.py +++ b/tests/api/test_statuses.py @@ -71,7 +71,7 @@ def test_mention_format(api_client, identity, remote_identity): ).json() assert ( response["content"] - == '

Hello, @test!

' + == '

Hello, @test!

' ) assert response["visibility"] == "unlisted" @@ -88,7 +88,7 @@ def test_mention_format(api_client, identity, remote_identity): ).json() assert ( response["text"] - == '

Hey @test

' + == '

Hey @test

' ) diff --git a/tests/core/test_html.py b/tests/core/test_html.py index 853d325..26d5f21 100644 --- a/tests/core/test_html.py +++ b/tests/core/test_html.py @@ -80,7 +80,8 @@ def test_parser(identity): find_emojis=True, ) assert ( - parser.html == '

@test

' + parser.html + == '

@test

' ) assert parser.plain_text == "@test@example.com" assert parser.mentions == {"test@example.com"} @@ -93,7 +94,8 @@ def test_parser(identity): find_emojis=True, ) assert ( - parser.html == '

@TeSt

' + parser.html + == '

@TeSt

' ) assert parser.plain_text == "@TeSt@ExamPle.com" assert parser.mentions == {"test@example.com"} @@ -135,6 +137,6 @@ def test_parser_same_name_mentions(remote_identity, remote_identity2): ) assert ( parser.html - == '@test @test' + == '@test @test' ) assert parser.plain_text == "@test @test"