about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorHampton Lintorn-Catlin <hcatlin@gmail.com>2022-11-13 23:52:13 -0500
committerGitHub <noreply@github.com>2022-11-14 05:52:13 +0100
commit147d8bd8fc7aa8b55cd5a9103941c52441ed4365 (patch)
treee55ac69320183ab704cf7d686d0fbfa71b2420ca /spec/services
parent9d039209cc0791ec09ebdbb93da4d63f815e1b07 (diff)
Support UTF-8 Characters in Domains During CSV Import (#20592)
* Support UTF-8 Characters in Domains During Import

* Update Changelong
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/import_service_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb
index 764225aa7..e2d182920 100644
--- a/spec/services/import_service_spec.rb
+++ b/spec/services/import_service_spec.rb
@@ -172,6 +172,29 @@ RSpec.describe ImportService, type: :service do
     end
   end
 
+  # Based on the bug report 20571 where UTF-8 encoded domains were rejecting import of their users
+  #
+  # https://github.com/mastodon/mastodon/issues/20571
+  context 'utf-8 encoded domains' do
+    subject { ImportService.new }
+
+    let!(:nare)     { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
+
+    # Make sure to not actually go to the remote server
+    before do
+      stub_request(:post, "https://թութ.հայ/inbox").to_return(status: 200)
+    end
+
+    let(:csv) { attachment_fixture('utf8-followers.txt') }
+    let(:import) { Import.create(account: account, type: 'following', data: csv) }
+
+    it 'follows the listed account' do
+    expect(account.follow_requests.count).to eq 0
+      subject.call(import)
+      expect(account.follow_requests.count).to eq 1
+    end
+  end
+
   context 'import bookmarks' do
     subject { ImportService.new }