{"action":"created","comment":{"url":"https://api.github.com/repos/diaspora/diaspora/pulls/comments/46080253","id":46080253,"diff_hunk":"@@ -0,0 +1,94 @@\n+shared_examples_for \"it deals correctly with a relayable\" do\n+  it \"treats upstream receive correctly\" do\n+    entity = FactoryGirl.build(\n+      entity_name,\n+      parent_guid: local_message.guid,\n+      diaspora_id: remote_user.person.diaspora_handle\n+    )\n+\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_id, remote_user.person.diaspora_handle)\n+                                              .once\n+                                              .and_return(remote_user.encryption_key)\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_post_guid, kind_of(String))\n+                                              .and_call_original\n+\n+    Workers::ReceiveEncryptedSalmon.new.perform(user.id, generate_xml(entity, remote_user, user))\n+    received_entity = klass.find_by(guid: entity.guid)\n+    expect(received_entity).not_to be_nil\n+    expect(received_entity.author.diaspora_handle).to eq(remote_user.person.diaspora_handle)\n+  end\n+\n+  it \"rejects an upstream entity with a malformed author signature\" do\n+    entity = FactoryGirl.build(\n+      entity_name,\n+      parent_guid:      local_message.guid,\n+      diaspora_id:      remote_user.person.diaspora_handle,\n+      author_signature: \"I'm a wrong signature\"\n+    )\n+\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_post_guid, kind_of(String))\n+                                              .and_call_original\n+\n+    Workers::ReceiveEncryptedSalmon.new.perform(user.id, generate_xml(entity, remote_user, user))\n+    expect(klass.exists?(guid: entity.guid)).to be(false)\n+  end\n+\n+  it \"treats downstream receive correctly\" do\n+    entity = FactoryGirl.build(\n+      entity_name,\n+      parent_guid: remote_message.guid,\n+      diaspora_id: remote_user.person.diaspora_handle\n+    )\n+\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_id, remote_user.person.diaspora_handle)\n+                                              .once\n+                                              .and_return(remote_user.encryption_key)\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_post_guid, remote_message.guid)\n+                                              .once\n+                                              .and_return(remote_user.encryption_key)\n+\n+    Workers::ReceiveEncryptedSalmon.new.perform(user.id, generate_xml(entity, remote_user, user))\n+    received_entity = klass.find_by(guid: entity.guid)\n+    expect(received_entity).not_to be_nil\n+    expect(received_entity.author.diaspora_handle).to eq(remote_user.person.diaspora_handle)\n+  end\n+\n+  it \"rejects a downstream entity with a malformed author signature\" do\n+    entity = FactoryGirl.build(\n+      entity_name,\n+      parent_guid:      local_message.guid,\n+      diaspora_id:      remote_user.person.diaspora_handle,\n+      author_signature: \"I'm a wrong signature\"\n+    )\n+\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_post_guid, local_message.guid)\n+                                              .once\n+                                              .and_return(remote_user.encryption_key)\n+\n+    Workers::ReceiveEncryptedSalmon.new.perform(user.id, generate_xml(entity, remote_user, user))\n+    expect(klass.exists?(guid: entity.guid)).to be(false)\n+  end\n+\n+  it \"declines downstream receive when parent signature is wrong\" do\n+    entity = FactoryGirl.build(\n+      entity_name,\n+      parent_guid:             remote_message.guid,\n+      diaspora_id:             remote_user.person.diaspora_handle,\n+      parent_author_signature: \"I'm a wrong signature\"\n+    )\n+\n+    expect(DiasporaFederation.callbacks).to receive(:trigger)\n+                                              .with(:fetch_private_key_by_id, remote_user.person.diaspora_handle)\n+                                              .once\n+                                              .and_return(remote_user.encryption_key)\n+\n+    Workers::ReceiveEncryptedSalmon.new.perform(user.id, generate_xml(entity, remote_user, user))\n+    expect(klass.exists?(guid: entity.guid)).to be(false)","path":"spec/integration/federation/shared_receive_relayable.rb","position":92,"original_position":92,"commit_id":"6df73df7c97be700019779736b7d5b9ad92b1ec5","original_commit_id":"6df73df7c97be700019779736b7d5b9ad92b1ec5","user":{"login":"cmrd-senya","id":10187586,"avatar_url":"https://avatars.githubusercontent.com/u/10187586?v=3","gravatar_id":"","url":"https://api.github.com/users/cmrd-senya","html_url":"https://github.com/cmrd-senya","followers_url":"https://api.github.com/users/cmrd-senya/followers","following_url":"https://api.github.com/users/cmrd-senya/following{/other_user}","gists_url":"https://api.github.com/users/cmrd-senya/gists{/gist_id}","starred_url":"https://api.github.com/users/cmrd-senya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmrd-senya/subscriptions","organizations_url":"https://api.github.com/users/cmrd-senya/orgs","repos_url":"https://api.github.com/users/cmrd-senya/repos","events_url":"https://api.github.com/users/cmrd-senya/events{/privacy}","received_events_url":"https://api.github.com/users/cmrd-senya/received_events","type":"User","site_admin":false},"body":"When I try this instead I get [the following](https://gist.github.com/cmrd-senya/1c1b1d880682ae471b88).","created_at":"2015-11-28T14:26:26Z","updated_at":"2015-11-28T14:26:26Z","html_url":"https://github.com/diaspora/diaspora/pull/6539#discussion_r46080253","pull_request_url":"https://api.github.com/repos/diaspora/diaspora/pulls/6539","_links":{"self":{"href":"https://api.github.com/repos/diaspora/diaspora/pulls/comments/46080253"},"html":{"href":"https://github.com/diaspora/diaspora/pull/6539#discussion_r46080253"},"pull_request":{"href":"https://api.github.com/repos/diaspora/diaspora/pulls/6539"}}},"pull_request":{"url":"https://api.github.com/repos/diaspora/diaspora/pulls/6539","id":50292703,"html_url":"https://github.com/diaspora/diaspora/pull/6539","diff_url":"https://github.com/diaspora/diaspora/pull/6539.diff","patch_url":"https://github.com/diaspora/diaspora/pull/6539.patch","issue_url":"https://api.github.com/repos/diaspora/diaspora/issues/6539","number":6539,"state":"open","locked":false,"title":"[WIP] Implement integration tests for the federation messages receive feature","user":{"login":"cmrd-senya","id":10187586,"avatar_url":"https://avatars.githubusercontent.com/u/10187586?v=3","gravatar_id":"","url":"https://api.github.com/users/cmrd-senya","html_url":"https://github.com/cmrd-senya","followers_url":"https://api.github.com/users/cmrd-senya/followers","following_url":"https://api.github.com/users/cmrd-senya/following{/other_user}","gists_url":"https://api.github.com/users/cmrd-senya/gists{/gist_id}","starred_url":"https://api.github.com/users/cmrd-senya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmrd-senya/subscriptions","organizations_url":"https://api.github.com/users/cmrd-senya/orgs","repos_url":"https://api.github.com/users/cmrd-senya/repos","events_url":"https://api.github.com/users/cmrd-senya/events{/privacy}","received_events_url":"https://api.github.com/users/cmrd-senya/received_events","type":"User","site_admin":false},"body":"This is some initial tests, more to come.\r\n\r\nrefs #5114 #6479","created_at":"2015-11-10T18:37:19Z","updated_at":"2015-11-28T14:26:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbddb5d48218a83c7bab8bbedfca3ad74375960e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/diaspora/diaspora/pulls/6539/commits","review_comments_url":"https://api.github.com/repos/diaspora/diaspora/pulls/6539/comments","review_comment_url":"https://api.github.com/repos/diaspora/diaspora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/diaspora/diaspora/issues/6539/comments","statuses_url":"https://api.github.com/repos/diaspora/diaspora/statuses/6df73df7c97be700019779736b7d5b9ad92b1ec5","head":{"label":"cmrd-senya:receive-tests","ref":"receive-tests","sha":"6df73df7c97be700019779736b7d5b9ad92b1ec5","user":{"login":"cmrd-senya","id":10187586,"avatar_url":"https://avatars.githubusercontent.com/u/10187586?v=3","gravatar_id":"","url":"https://api.github.com/users/cmrd-senya","html_url":"https://github.com/cmrd-senya","followers_url":"https://api.github.com/users/cmrd-senya/followers","following_url":"https://api.github.com/users/cmrd-senya/following{/other_user}","gists_url":"https://api.github.com/users/cmrd-senya/gists{/gist_id}","starred_url":"https://api.github.com/users/cmrd-senya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmrd-senya/subscriptions","organizations_url":"https://api.github.com/users/cmrd-senya/orgs","repos_url":"https://api.github.com/users/cmrd-senya/repos","events_url":"https://api.github.com/users/cmrd-senya/events{/privacy}","received_events_url":"https://api.github.com/users/cmrd-senya/received_events","type":"User","site_admin":false},"repo":{"id":38250193,"name":"diaspora","full_name":"cmrd-senya/diaspora","owner":{"login":"cmrd-senya","id":10187586,"avatar_url":"https://avatars.githubusercontent.com/u/10187586?v=3","gravatar_id":"","url":"https://api.github.com/users/cmrd-senya","html_url":"https://github.com/cmrd-senya","followers_url":"https://api.github.com/users/cmrd-senya/followers","following_url":"https://api.github.com/users/cmrd-senya/following{/other_user}","gists_url":"https://api.github.com/users/cmrd-senya/gists{/gist_id}","starred_url":"https://api.github.com/users/cmrd-senya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmrd-senya/subscriptions","organizations_url":"https://api.github.com/users/cmrd-senya/orgs","repos_url":"https://api.github.com/users/cmrd-senya/repos","events_url":"https://api.github.com/users/cmrd-senya/events{/privacy}","received_events_url":"https://api.github.com/users/cmrd-senya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cmrd-senya/diaspora","description":"Distributed and contextual social networking","fork":true,"url":"https://api.github.com/repos/cmrd-senya/diaspora","forks_url":"https://api.github.com/repos/cmrd-senya/diaspora/forks","keys_url":"https://api.github.com/repos/cmrd-senya/diaspora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmrd-senya/diaspora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmrd-senya/diaspora/teams","hooks_url":"https://api.github.com/repos/cmrd-senya/diaspora/hooks","issue_events_url":"https://api.github.com/repos/cmrd-senya/diaspora/issues/events{/number}","events_url":"https://api.github.com/repos/cmrd-senya/diaspora/events","assignees_url":"https://api.github.com/repos/cmrd-senya/diaspora/assignees{/user}","branches_url":"https://api.github.com/repos/cmrd-senya/diaspora/branches{/branch}","tags_url":"https://api.github.com/repos/cmrd-senya/diaspora/tags","blobs_url":"https://api.github.com/repos/cmrd-senya/diaspora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmrd-senya/diaspora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmrd-senya/diaspora/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmrd-senya/diaspora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmrd-senya/diaspora/statuses/{sha}","languages_url":"https://api.github.com/repos/cmrd-senya/diaspora/languages","stargazers_url":"https://api.github.com/repos/cmrd-senya/diaspora/stargazers","contributors_url":"https://api.github.com/repos/cmrd-senya/diaspora/contributors","subscribers_url":"https://api.github.com/repos/cmrd-senya/diaspora/subscribers","subscription_url":"https://api.github.com/repos/cmrd-senya/diaspora/subscription","commits_url":"https://api.github.com/repos/cmrd-senya/diaspora/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmrd-senya/diaspora/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmrd-senya/diaspora/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmrd-senya/diaspora/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmrd-senya/diaspora/contents/{+path}","compare_url":"https://api.github.com/repos/cmrd-senya/diaspora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmrd-senya/diaspora/merges","archive_url":"https://api.github.com/repos/cmrd-senya/diaspora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmrd-senya/diaspora/downloads","issues_url":"https://api.github.com/repos/cmrd-senya/diaspora/issues{/number}","pulls_url":"https://api.github.com/repos/cmrd-senya/diaspora/pulls{/number}","milestones_url":"https://api.github.com/repos/cmrd-senya/diaspora/milestones{/number}","notifications_url":"https://api.github.com/repos/cmrd-senya/diaspora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmrd-senya/diaspora/labels{/name}","releases_url":"https://api.github.com/repos/cmrd-senya/diaspora/releases{/id}","created_at":"2015-06-29T13:51:58Z","updated_at":"2015-06-29T13:52:03Z","pushed_at":"2015-11-25T20:02:31Z","git_url":"git://github.com/cmrd-senya/diaspora.git","ssh_url":"git@github.com:cmrd-senya/diaspora.git","clone_url":"https://github.com/cmrd-senya/diaspora.git","svn_url":"https://github.com/cmrd-senya/diaspora","homepage":"https://diasporafoundation.org/","size":102175,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"stable"}},"base":{"label":"diaspora:develop","ref":"develop","sha":"578f196a7bce7c5ef46faf3eaa29eb414525996d","user":{"login":"diaspora","id":293207,"avatar_url":"https://avatars.githubusercontent.com/u/293207?v=3","gravatar_id":"","url":"https://api.github.com/users/diaspora","html_url":"https://github.com/diaspora","followers_url":"https://api.github.com/users/diaspora/followers","following_url":"https://api.github.com/users/diaspora/following{/other_user}","gists_url":"https://api.github.com/users/diaspora/gists{/gist_id}","starred_url":"https://api.github.com/users/diaspora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diaspora/subscriptions","organizations_url":"https://api.github.com/users/diaspora/orgs","repos_url":"https://api.github.com/users/diaspora/repos","events_url":"https://api.github.com/users/diaspora/events{/privacy}","received_events_url":"https://api.github.com/users/diaspora/received_events","type":"Organization","site_admin":false},"repo":{"id":911765,"name":"diaspora","full_name":"diaspora/diaspora","owner":{"login":"diaspora","id":293207,"avatar_url":"https://avatars.githubusercontent.com/u/293207?v=3","gravatar_id":"","url":"https://api.github.com/users/diaspora","html_url":"https://github.com/diaspora","followers_url":"https://api.github.com/users/diaspora/followers","following_url":"https://api.github.com/users/diaspora/following{/other_user}","gists_url":"https://api.github.com/users/diaspora/gists{/gist_id}","starred_url":"https://api.github.com/users/diaspora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diaspora/subscriptions","organizations_url":"https://api.github.com/users/diaspora/orgs","repos_url":"https://api.github.com/users/diaspora/repos","events_url":"https://api.github.com/users/diaspora/events{/privacy}","received_events_url":"https://api.github.com/users/diaspora/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/diaspora/diaspora","description":"Distributed and contextual social networking","fork":false,"url":"https://api.github.com/repos/diaspora/diaspora","forks_url":"https://api.github.com/repos/diaspora/diaspora/forks","keys_url":"https://api.github.com/repos/diaspora/diaspora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diaspora/diaspora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diaspora/diaspora/teams","hooks_url":"https://api.github.com/repos/diaspora/diaspora/hooks","issue_events_url":"https://api.github.com/repos/diaspora/diaspora/issues/events{/number}","events_url":"https://api.github.com/repos/diaspora/diaspora/events","assignees_url":"https://api.github.com/repos/diaspora/diaspora/assignees{/user}","branches_url":"https://api.github.com/repos/diaspora/diaspora/branches{/branch}","tags_url":"https://api.github.com/repos/diaspora/diaspora/tags","blobs_url":"https://api.github.com/repos/diaspora/diaspora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diaspora/diaspora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diaspora/diaspora/git/refs{/sha}","trees_url":"https://api.github.com/repos/diaspora/diaspora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diaspora/diaspora/statuses/{sha}","languages_url":"https://api.github.com/repos/diaspora/diaspora/languages","stargazers_url":"https://api.github.com/repos/diaspora/diaspora/stargazers","contributors_url":"https://api.github.com/repos/diaspora/diaspora/contributors","subscribers_url":"https://api.github.com/repos/diaspora/diaspora/subscribers","subscription_url":"https://api.github.com/repos/diaspora/diaspora/subscription","commits_url":"https://api.github.com/repos/diaspora/diaspora/commits{/sha}","git_commits_url":"https://api.github.com/repos/diaspora/diaspora/git/commits{/sha}","comments_url":"https://api.github.com/repos/diaspora/diaspora/comments{/number}","issue_comment_url":"https://api.github.com/repos/diaspora/diaspora/issues/comments{/number}","contents_url":"https://api.github.com/repos/diaspora/diaspora/contents/{+path}","compare_url":"https://api.github.com/repos/diaspora/diaspora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diaspora/diaspora/merges","archive_url":"https://api.github.com/repos/diaspora/diaspora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diaspora/diaspora/downloads","issues_url":"https://api.github.com/repos/diaspora/diaspora/issues{/number}","pulls_url":"https://api.github.com/repos/diaspora/diaspora/pulls{/number}","milestones_url":"https://api.github.com/repos/diaspora/diaspora/milestones{/number}","notifications_url":"https://api.github.com/repos/diaspora/diaspora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diaspora/diaspora/labels{/name}","releases_url":"https://api.github.com/repos/diaspora/diaspora/releases{/id}","created_at":"2010-09-15T05:20:04Z","updated_at":"2015-11-27T14:50:21Z","pushed_at":"2015-11-27T11:48:30Z","git_url":"git://github.com/diaspora/diaspora.git","ssh_url":"git@github.com:diaspora/diaspora.git","clone_url":"https://github.com/diaspora/diaspora.git","svn_url":"https://github.com/diaspora/diaspora","homepage":"https://diasporafoundation.org/","size":232017,"stargazers_count":10390,"watchers_count":10390,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2691,"mirror_url":null,"open_issues_count":439,"forks":2691,"open_issues":439,"watchers":10390,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/diaspora/diaspora/pulls/6539"},"html":{"href":"https://github.com/diaspora/diaspora/pull/6539"},"issue":{"href":"https://api.github.com/repos/diaspora/diaspora/issues/6539"},"comments":{"href":"https://api.github.com/repos/diaspora/diaspora/issues/6539/comments"},"review_comments":{"href":"https://api.github.com/repos/diaspora/diaspora/pulls/6539/comments"},"review_comment":{"href":"https://api.github.com/repos/diaspora/diaspora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/diaspora/diaspora/pulls/6539/commits"},"statuses":{"href":"https://api.github.com/repos/diaspora/diaspora/statuses/6df73df7c97be700019779736b7d5b9ad92b1ec5"}}}}