{"action":"created","comment":{"url":"https://api.github.com/repos/fedora-infra/bodhi/pulls/comments/80746127","pull_request_review_id":1780371,"id":80746127,"diff_hunk":"@@ -1956,6 +1956,109 @@ def test_revoke_action_for_testing_request(self, publish, *args):\n         publish.assert_called_with(\n                 topic='update.request.revoke', msg=mock.ANY)\n \n+    @mock.patch(**mock_valid_requirements)\n+    @mock.patch('bodhi.server.notifications.publish')\n+    def test_obsolete_if_unstable_with_autopush_enabled_when_pending(self, publish, *args):\n+        \"\"\"\n+        Send update to obsolete state if it reaches unstable karma on\n+        pending state when Autopush is enabled. Make sure that it doesn't go\n+        to update-testing\n+        \"\"\"\n+        nvr = u'bodhi-2.0.0-2.fc17'\n+        args = self.get_update(nvr)\n+        args['autokarma'] = True\n+        args['stable_karma'] = 1\n+        args['unstable_karma'] = -1\n+\n+        resp = self.app.post_json('/updates/', args)\n+        up = Update.get(nvr, self.db)\n+        up.status = UpdateStatus.pending\n+        up.request = UpdateRequest.testing\n+        up.comment(self.db, u'Failed to work', author=u'ralph', karma=-1)\n+        self.db.flush()\n+\n+        up = self.db.query(Update).filter_by(title=nvr).one()\n+        self.assertEquals(up.karma, -1)\n+        self.assertEquals(up.status, UpdateStatus.obsolete)\n+        self.assertEquals(up.request, None)\n+\n+    @mock.patch(**mock_valid_requirements)\n+    @mock.patch('bodhi.server.notifications.publish')\n+    def test_obsolete_if_unstable_with_autopush_disabled_when_pending(self, publish, *args):\n+        \"\"\"\n+        Don't automatically send update to obsolete state if it reaches unstable karma on\n+        pending state when Autopush is disabled.\n+        \"\"\"\n+        nvr = u'bodhi-2.0.0-2.fc17'\n+        args = self.get_update(nvr)\n+        args['autokarma'] = False\n+        args['stable_karma'] = 1\n+        args['unstable_karma'] = -1\n+\n+        resp = self.app.post_json('/updates/', args)\n+        up = Update.get(nvr, self.db)\n+        up.status = UpdateStatus.pending\n+        up.request = UpdateRequest.testing\n+        up.comment(self.db, u'Failed to work', author=u'ralph', karma=-1)\n+        self.db.flush()\n+\n+        up = self.db.query(Update).filter_by(title=nvr).one()\n+        self.assertEquals(up.karma, -1)\n+        self.assertEquals(up.status, UpdateStatus.pending)\n+        self.assertNotEquals(up.status, UpdateStatus.obsolete)\n+        self.assertEquals(up.request, UpdateRequest.testing)\n+\n+    @mock.patch(**mock_valid_requirements)\n+    @mock.patch('bodhi.server.notifications.publish')\n+    def test_obsolete_if_unstable_karma_not_reached_with_autopush_enabled_when_pending(self, publish, *args):\n+        \"\"\"\n+        Don't send update to obsolete state if it does not reach unstable karma threshold\n+        on pending state when Autopush is enabled.\n+        \"\"\"\n+        nvr = u'bodhi-2.0.0-2.fc17'\n+        args = self.get_update(nvr)\n+        args['autokarma'] = True\n+        args['stable_karma'] = 2\n+        args['unstable_karma'] = -2\n+\n+        resp = self.app.post_json('/updates/', args)\n+        up = Update.get(nvr, self.db)\n+        up.status = UpdateStatus.pending\n+        up.request = UpdateRequest.testing\n+        up.comment(self.db, u'Failed to work', author=u'ralph', karma=-1)\n+        self.db.flush()\n+\n+        up = self.db.query(Update).filter_by(title=nvr).one()\n+        self.assertEquals(up.karma, -1)\n+        self.assertNotEquals(up.status, UpdateStatus.obsolete)\n+        self.assertEquals(up.status, UpdateStatus.pending)\n+        self.assertEquals(up.request, UpdateRequest.testing)\n+\n+    @mock.patch(**mock_valid_requirements)\n+    @mock.patch('bodhi.server.notifications.publish')\n+    def test_obsolete_if_unstable_with_autopush_enabled_when_testing(self, publish, *args):\n+        \"\"\"\n+        Send update to obsolete state if it reaches unstable karma threshold on\n+        testing state when Autopush is enabled.","path":"bodhi/tests/server/functional/test_updates.py","position":87,"original_position":87,"commit_id":"c8b419c45792675c97ca7afe99e18d218bf486f5","original_commit_id":"c8b419c45792675c97ca7afe99e18d218bf486f5","user":{"login":"trishnaguha","id":13337039,"avatar_url":"https://avatars.githubusercontent.com/u/13337039?v=3","gravatar_id":"","url":"https://api.github.com/users/trishnaguha","html_url":"https://github.com/trishnaguha","followers_url":"https://api.github.com/users/trishnaguha/followers","following_url":"https://api.github.com/users/trishnaguha/following{/other_user}","gists_url":"https://api.github.com/users/trishnaguha/gists{/gist_id}","starred_url":"https://api.github.com/users/trishnaguha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishnaguha/subscriptions","organizations_url":"https://api.github.com/users/trishnaguha/orgs","repos_url":"https://api.github.com/users/trishnaguha/repos","events_url":"https://api.github.com/users/trishnaguha/events{/privacy}","received_events_url":"https://api.github.com/users/trishnaguha/received_events","type":"User","site_admin":false},"body":"- The first test makes sure that the update doesn't go to testing(should be obsoleted) if it receives negative karma on the pending state where request is testing when autopush is enabled.\r\n\r\n- This test makes sure that the update doesn't got to stable(should be obsoleted) if it receives negative karma on the testing state where request is stable when autopush is enabled.","created_at":"2016-09-27T17:18:34Z","updated_at":"2016-09-27T17:18:35Z","html_url":"https://github.com/fedora-infra/bodhi/pull/901#discussion_r80746127","pull_request_url":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901","_links":{"self":{"href":"https://api.github.com/repos/fedora-infra/bodhi/pulls/comments/80746127"},"html":{"href":"https://github.com/fedora-infra/bodhi/pull/901#discussion_r80746127"},"pull_request":{"href":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901"}}},"pull_request":{"url":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901","id":83754715,"html_url":"https://github.com/fedora-infra/bodhi/pull/901","diff_url":"https://github.com/fedora-infra/bodhi/pull/901.diff","patch_url":"https://github.com/fedora-infra/bodhi/pull/901.patch","issue_url":"https://api.github.com/repos/fedora-infra/bodhi/issues/901","number":901,"state":"open","locked":false,"title":"Make sure that an update is obsoleted if it reaches unstable karma threshold in pending state","user":{"login":"trishnaguha","id":13337039,"avatar_url":"https://avatars.githubusercontent.com/u/13337039?v=3","gravatar_id":"","url":"https://api.github.com/users/trishnaguha","html_url":"https://github.com/trishnaguha","followers_url":"https://api.github.com/users/trishnaguha/followers","following_url":"https://api.github.com/users/trishnaguha/following{/other_user}","gists_url":"https://api.github.com/users/trishnaguha/gists{/gist_id}","starred_url":"https://api.github.com/users/trishnaguha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishnaguha/subscriptions","organizations_url":"https://api.github.com/users/trishnaguha/orgs","repos_url":"https://api.github.com/users/trishnaguha/repos","events_url":"https://api.github.com/users/trishnaguha/events{/privacy}","received_events_url":"https://api.github.com/users/trishnaguha/received_events","type":"User","site_admin":false},"body":"Fixes #880 ","created_at":"2016-09-02T07:06:32Z","updated_at":"2016-09-27T17:18:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b569f58c76640f1b8163163f73aa3929b942dcd6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901/commits","review_comments_url":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901/comments","review_comment_url":"https://api.github.com/repos/fedora-infra/bodhi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fedora-infra/bodhi/issues/901/comments","statuses_url":"https://api.github.com/repos/fedora-infra/bodhi/statuses/c8b419c45792675c97ca7afe99e18d218bf486f5","head":{"label":"trishnaguha:obsolete-package","ref":"obsolete-package","sha":"c8b419c45792675c97ca7afe99e18d218bf486f5","user":{"login":"trishnaguha","id":13337039,"avatar_url":"https://avatars.githubusercontent.com/u/13337039?v=3","gravatar_id":"","url":"https://api.github.com/users/trishnaguha","html_url":"https://github.com/trishnaguha","followers_url":"https://api.github.com/users/trishnaguha/followers","following_url":"https://api.github.com/users/trishnaguha/following{/other_user}","gists_url":"https://api.github.com/users/trishnaguha/gists{/gist_id}","starred_url":"https://api.github.com/users/trishnaguha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishnaguha/subscriptions","organizations_url":"https://api.github.com/users/trishnaguha/orgs","repos_url":"https://api.github.com/users/trishnaguha/repos","events_url":"https://api.github.com/users/trishnaguha/events{/privacy}","received_events_url":"https://api.github.com/users/trishnaguha/received_events","type":"User","site_admin":false},"repo":{"id":44370858,"name":"bodhi","full_name":"trishnaguha/bodhi","owner":{"login":"trishnaguha","id":13337039,"avatar_url":"https://avatars.githubusercontent.com/u/13337039?v=3","gravatar_id":"","url":"https://api.github.com/users/trishnaguha","html_url":"https://github.com/trishnaguha","followers_url":"https://api.github.com/users/trishnaguha/followers","following_url":"https://api.github.com/users/trishnaguha/following{/other_user}","gists_url":"https://api.github.com/users/trishnaguha/gists{/gist_id}","starred_url":"https://api.github.com/users/trishnaguha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trishnaguha/subscriptions","organizations_url":"https://api.github.com/users/trishnaguha/orgs","repos_url":"https://api.github.com/users/trishnaguha/repos","events_url":"https://api.github.com/users/trishnaguha/events{/privacy}","received_events_url":"https://api.github.com/users/trishnaguha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/trishnaguha/bodhi","description":"Bodhi is a web-system that facilitates the process of publishing updates for a Fedora-based software distribution.","fork":true,"url":"https://api.github.com/repos/trishnaguha/bodhi","forks_url":"https://api.github.com/repos/trishnaguha/bodhi/forks","keys_url":"https://api.github.com/repos/trishnaguha/bodhi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trishnaguha/bodhi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trishnaguha/bodhi/teams","hooks_url":"https://api.github.com/repos/trishnaguha/bodhi/hooks","issue_events_url":"https://api.github.com/repos/trishnaguha/bodhi/issues/events{/number}","events_url":"https://api.github.com/repos/trishnaguha/bodhi/events","assignees_url":"https://api.github.com/repos/trishnaguha/bodhi/assignees{/user}","branches_url":"https://api.github.com/repos/trishnaguha/bodhi/branches{/branch}","tags_url":"https://api.github.com/repos/trishnaguha/bodhi/tags","blobs_url":"https://api.github.com/repos/trishnaguha/bodhi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trishnaguha/bodhi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trishnaguha/bodhi/git/refs{/sha}","trees_url":"https://api.github.com/repos/trishnaguha/bodhi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trishnaguha/bodhi/statuses/{sha}","languages_url":"https://api.github.com/repos/trishnaguha/bodhi/languages","stargazers_url":"https://api.github.com/repos/trishnaguha/bodhi/stargazers","contributors_url":"https://api.github.com/repos/trishnaguha/bodhi/contributors","subscribers_url":"https://api.github.com/repos/trishnaguha/bodhi/subscribers","subscription_url":"https://api.github.com/repos/trishnaguha/bodhi/subscription","commits_url":"https://api.github.com/repos/trishnaguha/bodhi/commits{/sha}","git_commits_url":"https://api.github.com/repos/trishnaguha/bodhi/git/commits{/sha}","comments_url":"https://api.github.com/repos/trishnaguha/bodhi/comments{/number}","issue_comment_url":"https://api.github.com/repos/trishnaguha/bodhi/issues/comments{/number}","contents_url":"https://api.github.com/repos/trishnaguha/bodhi/contents/{+path}","compare_url":"https://api.github.com/repos/trishnaguha/bodhi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trishnaguha/bodhi/merges","archive_url":"https://api.github.com/repos/trishnaguha/bodhi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trishnaguha/bodhi/downloads","issues_url":"https://api.github.com/repos/trishnaguha/bodhi/issues{/number}","pulls_url":"https://api.github.com/repos/trishnaguha/bodhi/pulls{/number}","milestones_url":"https://api.github.com/repos/trishnaguha/bodhi/milestones{/number}","notifications_url":"https://api.github.com/repos/trishnaguha/bodhi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trishnaguha/bodhi/labels{/name}","releases_url":"https://api.github.com/repos/trishnaguha/bodhi/releases{/id}","deployments_url":"https://api.github.com/repos/trishnaguha/bodhi/deployments","created_at":"2015-10-16T07:58:46Z","updated_at":"2015-10-16T07:58:50Z","pushed_at":"2016-09-21T09:07:29Z","git_url":"git://github.com/trishnaguha/bodhi.git","ssh_url":"git@github.com:trishnaguha/bodhi.git","clone_url":"https://github.com/trishnaguha/bodhi.git","svn_url":"https://github.com/trishnaguha/bodhi","homepage":"http://bodhi.fedorahosted.org","size":33972,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"develop"}},"base":{"label":"fedora-infra:develop","ref":"develop","sha":"b2bbe77d8e093613d4b845d025ed7213f05328a2","user":{"login":"fedora-infra","id":3316637,"avatar_url":"https://avatars.githubusercontent.com/u/3316637?v=3","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"repo":{"id":123299,"name":"bodhi","full_name":"fedora-infra/bodhi","owner":{"login":"fedora-infra","id":3316637,"avatar_url":"https://avatars.githubusercontent.com/u/3316637?v=3","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fedora-infra/bodhi","description":"Bodhi is a web-system that facilitates the process of publishing updates for a Fedora-based software distribution.","fork":false,"url":"https://api.github.com/repos/fedora-infra/bodhi","forks_url":"https://api.github.com/repos/fedora-infra/bodhi/forks","keys_url":"https://api.github.com/repos/fedora-infra/bodhi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fedora-infra/bodhi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fedora-infra/bodhi/teams","hooks_url":"https://api.github.com/repos/fedora-infra/bodhi/hooks","issue_events_url":"https://api.github.com/repos/fedora-infra/bodhi/issues/events{/number}","events_url":"https://api.github.com/repos/fedora-infra/bodhi/events","assignees_url":"https://api.github.com/repos/fedora-infra/bodhi/assignees{/user}","branches_url":"https://api.github.com/repos/fedora-infra/bodhi/branches{/branch}","tags_url":"https://api.github.com/repos/fedora-infra/bodhi/tags","blobs_url":"https://api.github.com/repos/fedora-infra/bodhi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fedora-infra/bodhi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fedora-infra/bodhi/git/refs{/sha}","trees_url":"https://api.github.com/repos/fedora-infra/bodhi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fedora-infra/bodhi/statuses/{sha}","languages_url":"https://api.github.com/repos/fedora-infra/bodhi/languages","stargazers_url":"https://api.github.com/repos/fedora-infra/bodhi/stargazers","contributors_url":"https://api.github.com/repos/fedora-infra/bodhi/contributors","subscribers_url":"https://api.github.com/repos/fedora-infra/bodhi/subscribers","subscription_url":"https://api.github.com/repos/fedora-infra/bodhi/subscription","commits_url":"https://api.github.com/repos/fedora-infra/bodhi/commits{/sha}","git_commits_url":"https://api.github.com/repos/fedora-infra/bodhi/git/commits{/sha}","comments_url":"https://api.github.com/repos/fedora-infra/bodhi/comments{/number}","issue_comment_url":"https://api.github.com/repos/fedora-infra/bodhi/issues/comments{/number}","contents_url":"https://api.github.com/repos/fedora-infra/bodhi/contents/{+path}","compare_url":"https://api.github.com/repos/fedora-infra/bodhi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fedora-infra/bodhi/merges","archive_url":"https://api.github.com/repos/fedora-infra/bodhi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fedora-infra/bodhi/downloads","issues_url":"https://api.github.com/repos/fedora-infra/bodhi/issues{/number}","pulls_url":"https://api.github.com/repos/fedora-infra/bodhi/pulls{/number}","milestones_url":"https://api.github.com/repos/fedora-infra/bodhi/milestones{/number}","notifications_url":"https://api.github.com/repos/fedora-infra/bodhi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fedora-infra/bodhi/labels{/name}","releases_url":"https://api.github.com/repos/fedora-infra/bodhi/releases{/id}","deployments_url":"https://api.github.com/repos/fedora-infra/bodhi/deployments","created_at":"2009-02-06T19:38:10Z","updated_at":"2016-09-26T12:06:12Z","pushed_at":"2016-09-27T16:11:00Z","git_url":"git://github.com/fedora-infra/bodhi.git","ssh_url":"git@github.com:fedora-infra/bodhi.git","clone_url":"https://github.com/fedora-infra/bodhi.git","svn_url":"https://github.com/fedora-infra/bodhi","homepage":"https://bodhi.fedoraproject.org","size":37950,"stargazers_count":28,"watchers_count":28,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":195,"forks":64,"open_issues":195,"watchers":28,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901"},"html":{"href":"https://github.com/fedora-infra/bodhi/pull/901"},"issue":{"href":"https://api.github.com/repos/fedora-infra/bodhi/issues/901"},"comments":{"href":"https://api.github.com/repos/fedora-infra/bodhi/issues/901/comments"},"review_comments":{"href":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901/comments"},"review_comment":{"href":"https://api.github.com/repos/fedora-infra/bodhi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fedora-infra/bodhi/pulls/901/commits"},"statuses":{"href":"https://api.github.com/repos/fedora-infra/bodhi/statuses/c8b419c45792675c97ca7afe99e18d218bf486f5"}}}}
{"actor":{"display_login":"trishnaguha"}}