diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-08-22 20:56:32 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-08-22 20:56:32 +0200 |
commit | e70fc059a9511d43b42c2502514f6220b416cdd5 (patch) | |
tree | abc0ea9862c55c2e114c855b20eb4a35f1141709 /spec/services/fetch_remote_account_service_spec.rb | |
parent | 628fca50e20bcf41f206877083fc5ee8789c1088 (diff) | |
parent | 56f882aed6fc81bbe4fb8821f11ba196795c99a8 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'spec/services/fetch_remote_account_service_spec.rb')
-rw-r--r-- | spec/services/fetch_remote_account_service_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/services/fetch_remote_account_service_spec.rb b/spec/services/fetch_remote_account_service_spec.rb index 1c3abe8f3..20dd505d0 100644 --- a/spec/services/fetch_remote_account_service_spec.rb +++ b/spec/services/fetch_remote_account_service_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.describe FetchRemoteAccountService, type: :service do - let(:url) { 'https://example.com' } + let(:url) { 'https://example.com/alice' } let(:prefetched_body) { nil } let(:protocol) { :ostatus } subject { FetchRemoteAccountService.new.call(url, prefetched_body, protocol) } @@ -46,6 +46,24 @@ RSpec.describe FetchRemoteAccountService, type: :service do end include_examples 'return Account' + + it 'does not update account information if XML comes from an unverified domain' do + feed_xml = <<-XML.squish + <?xml version="1.0" encoding="UTF-8"?> + <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/"> + <author> + <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> + <uri>http://kickass.zone/users/localhost</uri> + <name>localhost</name> + <poco:preferredUsername>localhost</poco:preferredUsername> + <poco:displayName>Villain!!!</poco:displayName> + </author> + </feed> + XML + + returned_account = described_class.new.call('https://real-fake-domains.com/alice', feed_xml, :ostatus) + expect(returned_account.display_name).to_not eq 'Villain!!!' + end end context 'when prefetched_body is nil' do |