diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-03-02 16:33:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 16:33:06 +0100 |
commit | f4abf8e7829c6a5b952dea6fb9ad01b6b3601f95 (patch) | |
tree | afc41f393d862885eae63cccd3b72262ce08128b /spec/services/resolve_account_service_spec.rb | |
parent | 4aa860b65bd796b09dc0ceffa1fdd7de31060a34 (diff) | |
parent | 7336276252ab89985c609359eb9953fca0383db3 (diff) |
Merge pull request #1504 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/services/resolve_account_service_spec.rb')
-rw-r--r-- | spec/services/resolve_account_service_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/services/resolve_account_service_spec.rb b/spec/services/resolve_account_service_spec.rb index a604e90b5..7b1e8885c 100644 --- a/spec/services/resolve_account_service_spec.rb +++ b/spec/services/resolve_account_service_spec.rb @@ -13,6 +13,47 @@ RSpec.describe ResolveAccountService, type: :service do stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:hoge@example.com').to_return(status: 410) end + context 'using skip_webfinger' do + context 'when account is known' do + let!(:remote_account) { Fabricate(:account, username: 'foo', domain: 'ap.example.com', protocol: 'activitypub') } + + context 'when domain is banned' do + let!(:domain_block) { Fabricate(:domain_block, domain: 'ap.example.com', severity: :suspend) } + + it 'does not return an account' do + expect(subject.call('foo@ap.example.com', skip_webfinger: true)).to be_nil + end + + it 'does not make a webfinger query' do + subject.call('foo@ap.example.com', skip_webfinger: true) + expect(a_request(:get, 'https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com')).to_not have_been_made + end + end + + context 'when domain is not banned' do + it 'returns the expected account' do + expect(subject.call('foo@ap.example.com', skip_webfinger: true)).to eq remote_account + end + + it 'does not make a webfinger query' do + subject.call('foo@ap.example.com', skip_webfinger: true) + expect(a_request(:get, 'https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com')).to_not have_been_made + end + end + end + + context 'when account is not known' do + it 'does not return an account' do + expect(subject.call('foo@ap.example.com', skip_webfinger: true)).to be_nil + end + + it 'does not make a webfinger query' do + subject.call('foo@ap.example.com', skip_webfinger: true) + expect(a_request(:get, 'https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com')).to_not have_been_made + end + end + end + context 'when there is an LRDD endpoint but no resolvable account' do before do stub_request(:get, "https://quitter.no/.well-known/host-meta").to_return(request_fixture('.host-meta.txt')) |