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/activitypub | |
parent | 628fca50e20bcf41f206877083fc5ee8789c1088 (diff) | |
parent | e70fc059a9511d43b42c2502514f6220b416cdd5 (diff) |
Merge pull request #665 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/services/activitypub')
-rw-r--r-- | spec/services/activitypub/fetch_remote_account_service_spec.rb | 7 | ||||
-rw-r--r-- | spec/services/activitypub/fetch_remote_status_service_spec.rb | 22 |
2 files changed, 28 insertions, 1 deletions
diff --git a/spec/services/activitypub/fetch_remote_account_service_spec.rb b/spec/services/activitypub/fetch_remote_account_service_spec.rb index dba55c034..aa13f0a9b 100644 --- a/spec/services/activitypub/fetch_remote_account_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_account_service_spec.rb @@ -59,7 +59,6 @@ RSpec.describe ActivityPub::FetchRemoteAccountService, type: :service do it 'returns nil' do expect(account).to be_nil end - end context 'when URI and WebFinger share the same host' do @@ -119,5 +118,11 @@ RSpec.describe ActivityPub::FetchRemoteAccountService, type: :service do include_examples 'sets profile data' end + + context 'with wrong id' do + it 'does not create account' do + expect(subject.call('https://fake.address/@foo', prefetched_body: Oj.dump(actor))).to be_nil + end + end end end diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb index 549eb80fa..9ae409996 100644 --- a/spec/services/activitypub/fetch_remote_status_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb @@ -70,5 +70,27 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do expect(strip_tags(status.text)).to eq "Nyan Cat 10 hours remix https://#{valid_domain}/watch?v=12345" end end + + context 'with wrong id' do + let(:note) do + { + '@context': 'https://www.w3.org/ns/activitystreams', + id: "https://real.address/@foo/1234", + type: 'Note', + content: 'Lorem ipsum', + attributedTo: ActivityPub::TagManager.instance.uri_for(sender), + } + end + + let(:object) do + temp = note.dup + temp[:id] = 'https://fake.address/@foo/5678' + temp + end + + it 'does not create status' do + expect(sender.statuses.first).to be_nil + end + end end end |