Add some tests

This commit is contained in:
Evan Summers 2025-08-08 20:48:25 +02:00
parent 9c9dd66129
commit 6205d42462
3 changed files with 11 additions and 3 deletions

View File

@ -289,6 +289,8 @@ RSpec.describe Settings::ImportsController do
it_behaves_like 'successful import', 'domain_blocking', 'domain_blocks.csv', 'overwrite'
it_behaves_like 'successful import', 'bookmarks', 'bookmark-imports.txt', 'merge'
it_behaves_like 'successful import', 'bookmarks', 'bookmark-imports.txt', 'overwrite'
it_behaves_like 'successful import', 'filters', 'filters.csv', 'merge'
it_behaves_like 'successful import', 'filters', 'filters.csv', 'overwrite'
it_behaves_like 'unsuccessful import', 'following', 'domain_blocks.csv', 'merge'
it_behaves_like 'unsuccessful import', 'following', 'domain_blocks.csv', 'overwrite'
@ -296,6 +298,8 @@ RSpec.describe Settings::ImportsController do
it_behaves_like 'unsuccessful import', 'blocking', 'domain_blocks.csv', 'overwrite'
it_behaves_like 'unsuccessful import', 'muting', 'domain_blocks.csv', 'merge'
it_behaves_like 'unsuccessful import', 'muting', 'domain_blocks.csv', 'overwrite'
it_behaves_like 'unsuccessful import', 'filters', 'domain_blocks.csv', 'merge'
it_behaves_like 'unsuccessful import', 'filters', 'domain_blocks.csv', 'overwrite'
it_behaves_like 'unsuccessful import', 'following', 'empty.csv', 'merge'
it_behaves_like 'unsuccessful import', 'following', 'empty.csv', 'overwrite'

View File

@ -0,0 +1,4 @@
Title,Context,Keywords,Whole Word,Action,Expire after
current events,"[""home"", ""public"", ""account""]","[""minions song contest""]",[true],warn,2025-08-14 21:33:29 UTC
unwanted solicitations,"[""notifications"", ""thread""]","[""wizard school enrolment""]",[false],hide,
scary things,"[""home"", ""public""]","[""flying sharks"", ""sapient crabs""]","[true, false]",blur,
1 Title Context Keywords Whole Word Action Expire after
1 Title Context Keywords Whole Word Action Expire after
2 current events ["home", "public", "account"] ["minions song contest"] [true] warn 2025-08-14 21:33:29 UTC
3 unwanted solicitations ["notifications", "thread"] ["wizard school enrolment"] [false] hide
4 scary things ["home", "public"] ["flying sharks", "sapient crabs"] [true, false] blur

View File

@ -283,9 +283,9 @@ RSpec.describe Form::Import do
]
it_behaves_like 'on successful import', 'filters', 'merge', 'filters.csv', [
{ 'acct' => 'gargron@example.com', 'list_name' => 'Mastodon project' },
{ 'acct' => 'mastodon@example.com', 'list_name' => 'Mastodon project' },
{ 'acct' => 'foo@example.com', 'list_name' => 'test' },
{ 'title' => 'current events', 'context' => %w(home public account), 'keywords' => ['minions song contest'], 'whole_word' => [true], 'action' => 'warn', 'expires_at' => Time.zone.parse('2025-08-14 21:33:29 UTC') },
{ 'title' => 'unwanted solicitations', 'context' => %w(notifications thread), 'keywords' => ['wizard school enrolment'], 'whole_word' => [false], 'action' => 'hide', 'expires_at' => nil },
{ 'title' => 'scary things', 'context' => %w(home public), 'keywords' => ['flying sharks', 'sapient crabs'], 'whole_word' => [true, false], 'action' => 'blur', 'expires_at' => nil },
]
# Based on the bug report 20571 where UTF-8 encoded domains were rejecting import of their users