{"action":"created","comment":{"url":"https://api.github.com/repos/matrix-org/sytest/pulls/comments/60411579","id":60411579,"diff_hunk":"@@ -0,0 +1,104 @@\n+sub create_pusher\n+{\n+   my ( $user, $app_id, $push_key, $url ) = @_;\n+\n+   do_request_json_for( $user,\n+      method  => \"POST\",\n+      uri     => \"/r0/pushers/set\",\n+      content => {\n+         profile_tag         => \"tag1\",\n+         kind                => \"http\",\n+         app_id              => $app_id,\n+         app_display_name    => \"sytest_display_name\",\n+         device_display_name => \"device_display_name\",\n+         pushkey             => $push_key,\n+         lang                => \"en\",\n+         data                => { url => $url },\n+      },\n+   );\n+}\n+\n+sub wait_for_push\n+{\n+   my ( $path, $response ) = @_;\n+   await_http_request( $path, sub {\n+     my ( $request ) = @_;\n+     my $body = $request->body_from_json;\n+\n+     return unless $body->{notification}{type};\n+     return unless $body->{notification}{type} eq \"m.room.message\";\n+     return 1;\n+   })->then( sub {\n+      my ( $request ) = @_;\n+\n+      $request->respond_json( $response // {} );\n+      Future->done( $request );\n+   });\n+}\n+\n+multi_test \"Test that rejected pushers are removed.\",\n+   requires => [\n+      local_user_fixtures( 2, with_events => 0 ),\n+      $main::TEST_SERVER_INFO,\n+   ],\n+\n+   do => sub {\n+      my ( $alice, $bob, $test_server_info ) = @_;\n+\n+      my $room_id;\n+\n+      my $url = $test_server_info->client_location . \"/alice_push\";\n+\n+      matrix_create_room( $alice, visibility => \"private\" )->then( sub {\n+         ( $room_id ) = @_;\n+         matrix_invite_user_to_room( $alice, $bob, $room_id ),\n+      })->then( sub {\n+         matrix_join_room( $bob, $room_id);\n+      })->then( sub {\n+         matrix_send_room_text_message(\n+            $bob, $room_id, body => \"message\"\n+         )->then( sub {\n+            my ( $event_id ) = @_;\n+            matrix_advance_room_receipt( $alice, $room_id,\n+                \"m.read\" => $event_id\n+            );\n+         });\n+      })->then( sub {\n+         create_pusher( $alice, \"sytest\", \"key_1\", \"$url/1\" )\n+            ->SyTest::pass_on_done( \"Alice's pusher 1 created\" );\n+      })->then( sub {\n+         create_pusher( $alice, \"sytest\", \"key_2\", \"$url/2\" )\n+            ->SyTest::pass_on_done( \"Alice's pusher 2 created\" );\n+      })->then( sub {\n+         do_request_json_for( $alice,\n+              method  => \"GET\",\n+              uri     => \"/r0/pushers\",\n+         )->then( sub {\n+            my ( $body ) = @_;\n+\n+            assert_json_keys( $body, qw( pushers ) );\n+            @{ $body->{pushers} } == 2 or die \"Expected two pushers\";\n+\n+            Future->done(1);\n+         });\n+      })->then( sub {\n+         Future->needs_all(\n+            wait_for_push( \"/alice_push/1\",  { rejected => [ \"key_1\" ] } ),\n+            wait_for_push( \"/alice_push/2\" ),\n+            matrix_send_room_text_message( $bob, $room_id, body => \"message\" )\n+               ->SyTest::pass_on_done( \"Message Sent\" ),\n+         );\n+      })->then( sub {\n+         do_request_json_for( $alice,\n+              method  => \"GET\",\n+              uri     => \"/r0/pushers\",\n+         )->then( sub {\n+            my ( $body ) = @_;\n+\n+            assert_json_keys( $body, qw( pushers ) );\n+            @{ $body->{pushers} } == 1 or die \"Expected one pusher\";","path":"tests/61push/08_rejected_pushers.pl","position":111,"original_position":99,"commit_id":"1b84a4300bea73a9067cb658eb0818e8e92b7e8e","original_commit_id":"542f4e7c4321e6e7d506ed80859188738c9f960e","user":{"login":"NegativeMjark","id":904009,"avatar_url":"https://avatars.githubusercontent.com/u/904009?v=3","gravatar_id":"","url":"https://api.github.com/users/NegativeMjark","html_url":"https://github.com/NegativeMjark","followers_url":"https://api.github.com/users/NegativeMjark/followers","following_url":"https://api.github.com/users/NegativeMjark/following{/other_user}","gists_url":"https://api.github.com/users/NegativeMjark/gists{/gist_id}","starred_url":"https://api.github.com/users/NegativeMjark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NegativeMjark/subscriptions","organizations_url":"https://api.github.com/users/NegativeMjark/orgs","repos_url":"https://api.github.com/users/NegativeMjark/repos","events_url":"https://api.github.com/users/NegativeMjark/events{/privacy}","received_events_url":"https://api.github.com/users/NegativeMjark/received_events","type":"User","site_admin":false},"body":"Done 1b84a43","created_at":"2016-04-20T13:58:20Z","updated_at":"2016-04-20T13:58:20Z","html_url":"https://github.com/matrix-org/sytest/pull/229#discussion_r60411579","pull_request_url":"https://api.github.com/repos/matrix-org/sytest/pulls/229","_links":{"self":{"href":"https://api.github.com/repos/matrix-org/sytest/pulls/comments/60411579"},"html":{"href":"https://github.com/matrix-org/sytest/pull/229#discussion_r60411579"},"pull_request":{"href":"https://api.github.com/repos/matrix-org/sytest/pulls/229"}}},"pull_request":{"url":"https://api.github.com/repos/matrix-org/sytest/pulls/229","id":66857746,"html_url":"https://github.com/matrix-org/sytest/pull/229","diff_url":"https://github.com/matrix-org/sytest/pull/229.diff","patch_url":"https://github.com/matrix-org/sytest/pull/229.patch","issue_url":"https://api.github.com/repos/matrix-org/sytest/issues/229","number":229,"state":"open","locked":false,"title":"Test that rejected pushers are removed","user":{"login":"NegativeMjark","id":904009,"avatar_url":"https://avatars.githubusercontent.com/u/904009?v=3","gravatar_id":"","url":"https://api.github.com/users/NegativeMjark","html_url":"https://github.com/NegativeMjark","followers_url":"https://api.github.com/users/NegativeMjark/followers","following_url":"https://api.github.com/users/NegativeMjark/following{/other_user}","gists_url":"https://api.github.com/users/NegativeMjark/gists{/gist_id}","starred_url":"https://api.github.com/users/NegativeMjark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NegativeMjark/subscriptions","organizations_url":"https://api.github.com/users/NegativeMjark/orgs","repos_url":"https://api.github.com/users/NegativeMjark/repos","events_url":"https://api.github.com/users/NegativeMjark/events{/privacy}","received_events_url":"https://api.github.com/users/NegativeMjark/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-18T13:58:41Z","updated_at":"2016-04-20T13:58:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"67994e112a2c4cc7199259b295248fd0efba7b2b","assignee":{"login":"leonerd","id":350941,"avatar_url":"https://avatars.githubusercontent.com/u/350941?v=3","gravatar_id":"","url":"https://api.github.com/users/leonerd","html_url":"https://github.com/leonerd","followers_url":"https://api.github.com/users/leonerd/followers","following_url":"https://api.github.com/users/leonerd/following{/other_user}","gists_url":"https://api.github.com/users/leonerd/gists{/gist_id}","starred_url":"https://api.github.com/users/leonerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonerd/subscriptions","organizations_url":"https://api.github.com/users/leonerd/orgs","repos_url":"https://api.github.com/users/leonerd/repos","events_url":"https://api.github.com/users/leonerd/events{/privacy}","received_events_url":"https://api.github.com/users/leonerd/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/matrix-org/sytest/pulls/229/commits","review_comments_url":"https://api.github.com/repos/matrix-org/sytest/pulls/229/comments","review_comment_url":"https://api.github.com/repos/matrix-org/sytest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/matrix-org/sytest/issues/229/comments","statuses_url":"https://api.github.com/repos/matrix-org/sytest/statuses/1b84a4300bea73a9067cb658eb0818e8e92b7e8e","head":{"label":"matrix-org:markjh/delete_pusher","ref":"markjh/delete_pusher","sha":"1b84a4300bea73a9067cb658eb0818e8e92b7e8e","user":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"repo":{"id":23436169,"name":"sytest","full_name":"matrix-org/sytest","owner":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-org/sytest","description":"Black-box integration testing for Matrix homeservers","fork":false,"url":"https://api.github.com/repos/matrix-org/sytest","forks_url":"https://api.github.com/repos/matrix-org/sytest/forks","keys_url":"https://api.github.com/repos/matrix-org/sytest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-org/sytest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-org/sytest/teams","hooks_url":"https://api.github.com/repos/matrix-org/sytest/hooks","issue_events_url":"https://api.github.com/repos/matrix-org/sytest/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-org/sytest/events","assignees_url":"https://api.github.com/repos/matrix-org/sytest/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-org/sytest/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-org/sytest/tags","blobs_url":"https://api.github.com/repos/matrix-org/sytest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-org/sytest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-org/sytest/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-org/sytest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-org/sytest/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-org/sytest/languages","stargazers_url":"https://api.github.com/repos/matrix-org/sytest/stargazers","contributors_url":"https://api.github.com/repos/matrix-org/sytest/contributors","subscribers_url":"https://api.github.com/repos/matrix-org/sytest/subscribers","subscription_url":"https://api.github.com/repos/matrix-org/sytest/subscription","commits_url":"https://api.github.com/repos/matrix-org/sytest/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-org/sytest/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-org/sytest/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-org/sytest/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-org/sytest/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-org/sytest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-org/sytest/merges","archive_url":"https://api.github.com/repos/matrix-org/sytest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-org/sytest/downloads","issues_url":"https://api.github.com/repos/matrix-org/sytest/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-org/sytest/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-org/sytest/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-org/sytest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-org/sytest/labels{/name}","releases_url":"https://api.github.com/repos/matrix-org/sytest/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-org/sytest/deployments","created_at":"2014-08-28T17:05:43Z","updated_at":"2016-01-11T16:43:34Z","pushed_at":"2016-04-20T13:57:55Z","git_url":"git://github.com/matrix-org/sytest.git","ssh_url":"git@github.com:matrix-org/sytest.git","clone_url":"https://github.com/matrix-org/sytest.git","svn_url":"https://github.com/matrix-org/sytest","homepage":"","size":1805,"stargazers_count":2,"watchers_count":2,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"develop"}},"base":{"label":"matrix-org:develop","ref":"develop","sha":"71e2f79bcc20480e5afa97525fa35e71c2710045","user":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"repo":{"id":23436169,"name":"sytest","full_name":"matrix-org/sytest","owner":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-org/sytest","description":"Black-box integration testing for Matrix homeservers","fork":false,"url":"https://api.github.com/repos/matrix-org/sytest","forks_url":"https://api.github.com/repos/matrix-org/sytest/forks","keys_url":"https://api.github.com/repos/matrix-org/sytest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-org/sytest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-org/sytest/teams","hooks_url":"https://api.github.com/repos/matrix-org/sytest/hooks","issue_events_url":"https://api.github.com/repos/matrix-org/sytest/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-org/sytest/events","assignees_url":"https://api.github.com/repos/matrix-org/sytest/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-org/sytest/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-org/sytest/tags","blobs_url":"https://api.github.com/repos/matrix-org/sytest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-org/sytest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-org/sytest/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-org/sytest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-org/sytest/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-org/sytest/languages","stargazers_url":"https://api.github.com/repos/matrix-org/sytest/stargazers","contributors_url":"https://api.github.com/repos/matrix-org/sytest/contributors","subscribers_url":"https://api.github.com/repos/matrix-org/sytest/subscribers","subscription_url":"https://api.github.com/repos/matrix-org/sytest/subscription","commits_url":"https://api.github.com/repos/matrix-org/sytest/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-org/sytest/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-org/sytest/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-org/sytest/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-org/sytest/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-org/sytest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-org/sytest/merges","archive_url":"https://api.github.com/repos/matrix-org/sytest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-org/sytest/downloads","issues_url":"https://api.github.com/repos/matrix-org/sytest/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-org/sytest/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-org/sytest/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-org/sytest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-org/sytest/labels{/name}","releases_url":"https://api.github.com/repos/matrix-org/sytest/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-org/sytest/deployments","created_at":"2014-08-28T17:05:43Z","updated_at":"2016-01-11T16:43:34Z","pushed_at":"2016-04-20T13:57:55Z","git_url":"git://github.com/matrix-org/sytest.git","ssh_url":"git@github.com:matrix-org/sytest.git","clone_url":"https://github.com/matrix-org/sytest.git","svn_url":"https://github.com/matrix-org/sytest","homepage":"","size":1805,"stargazers_count":2,"watchers_count":2,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/matrix-org/sytest/pulls/229"},"html":{"href":"https://github.com/matrix-org/sytest/pull/229"},"issue":{"href":"https://api.github.com/repos/matrix-org/sytest/issues/229"},"comments":{"href":"https://api.github.com/repos/matrix-org/sytest/issues/229/comments"},"review_comments":{"href":"https://api.github.com/repos/matrix-org/sytest/pulls/229/comments"},"review_comment":{"href":"https://api.github.com/repos/matrix-org/sytest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/matrix-org/sytest/pulls/229/commits"},"statuses":{"href":"https://api.github.com/repos/matrix-org/sytest/statuses/1b84a4300bea73a9067cb658eb0818e8e92b7e8e"}}}}