diff options
author | ThibG <thib@sitedethib.com> | 2018-08-22 21:35:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-22 21:35:07 +0200 |
commit | 8aa58e34bb2b62192a997ac7ea8919b22fc45f80 (patch) | |
tree | abc0ea9862c55c2e114c855b20eb4a35f1141709 /spec/services/fetch_remote_account_service_spec.rb | |
parent | 628fca50e20bcf41f206877083fc5ee8789c1088 (diff) | |
parent | e70fc059a9511d43b42c2502514f6220b416cdd5 (diff) |
Merge pull request #665 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
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 |