{"action":"created","comment":{"url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/comments/167929651","pull_request_review_id":96213598,"id":167929651,"diff_hunk":"@@ -950,3 +953,74 @@ def test_opengl_vendor():\n     \"\"\"Simply call version.opengl_vendor() and see if it doesn't crash.\"\"\"\n     pytest.importorskip(\"PyQt5.QtOpenGL\")\n     return version.opengl_vendor()\n+\n+\n+class HTTPPostStub(QObject):\n+\n+    \"\"\"A stub class for HTTPClient.\n+\n+    Attributes:\n+        url: the last url send by post()\n+        data: the last data send by post()\n+    \"\"\"\n+\n+    success = pyqtSignal(str)\n+    error = pyqtSignal(str)\n+\n+    def __init__(self, parent=None):\n+        super().__init__(parent)\n+        self.url = None\n+        self.data = None\n+\n+    def post(self, url, data=None):\n+        self.url = url\n+        self.data = data\n+\n+\n+@pytest.fixture\n+def pbclient():\n+    http_stub = HTTPPostStub()\n+    client = pastebin.PastebinClient(http_stub)\n+    return client\n+\n+\n+def test_pastebin_version(pbclient, monkeypatch):\n+    \"\"\"Test version.pastebin_version() twice.\"\"\"\n+    patches = {\n+        '_path_info': lambda: {'PATH DESC': 'PATH NAME'},\n+        '_uptime': lambda: datetime.timedelta(hours=1, minutes=23, seconds=45),\n+    }\n+\n+    for name, val in patches.items():\n+        monkeypatch.setattr('qutebrowser.utils.version.' + name, val)\n+\n+    version.pastebin_version(pbclient)\n+    pbclient.success.emit(\"test\")\n+    assert version.pastebin_url == \"test\"\n+\n+    version.pastebin_version(pbclient)\n+    assert version.pastebin_url == \"test\"\n+\n+\n+def test_pastebin_version_error(pbclient, caplog, monkeypatch):\n+    \"\"\"Test version.pastebin_version() with errors.\"\"\"\n+    patches = {\n+        '_path_info': lambda: {'PATH DESC': 'PATH NAME'},\n+        '_uptime': lambda: datetime.timedelta(hours=1, minutes=23, seconds=45),\n+    }\n+\n+    for name, val in patches.items():\n+        monkeypatch.setattr('qutebrowser.utils.version.' + name, val)\n+\n+    version.pastebin_url = None\n+    with caplog.at_level(logging.ERROR):\n+        version.pastebin_version(pbclient)\n+        pbclient._client.error.emit(\"test\")\n+    assert version.pastebin_url is None\n+    assert caplog.records[0].message == \"Failed to pastebin version info: test\"\n+\n+\n+def test_uptime(monkeypatch):\n+    \"\"\"Test _uptime runs without failing. Its effects are tested elsewhere.\"\"\"\n+    QApplication.instance().launch_time = datetime.datetime(1, 1, 1)","path":"tests/unit/utils/test_version.py","position":86,"original_position":86,"commit_id":"cfa779ecb7b417191f8596209a7f461a0d1f7317","original_commit_id":"cfa779ecb7b417191f8596209a7f461a0d1f7317","user":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars0.githubusercontent.com/u/625793?v=4","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"body":"You should use `monkeypatch.setattr` for things like this, otherwise this attribute stays there for other tests which it shouldn't. Also, you can use the `qapp` fixture instead of `QApplication.instance()`.","created_at":"2018-02-13T16:54:18Z","updated_at":"2018-02-13T16:54:24Z","html_url":"https://github.com/qutebrowser/qutebrowser/pull/3594#discussion_r167929651","pull_request_url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/comments/167929651"},"html":{"href":"https://github.com/qutebrowser/qutebrowser/pull/3594#discussion_r167929651"},"pull_request":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594"}}},"pull_request":{"url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594","id":168845733,"html_url":"https://github.com/qutebrowser/qutebrowser/pull/3594","diff_url":"https://github.com/qutebrowser/qutebrowser/pull/3594.diff","patch_url":"https://github.com/qutebrowser/qutebrowser/pull/3594.patch","issue_url":"https://api.github.com/repos/qutebrowser/qutebrowser/issues/3594","number":3594,"state":"open","locked":false,"title":"Add test for pastebin_version()","user":{"login":"gebulmer","id":32779206,"avatar_url":"https://avatars3.githubusercontent.com/u/32779206?v=4","gravatar_id":"","url":"https://api.github.com/users/gebulmer","html_url":"https://github.com/gebulmer","followers_url":"https://api.github.com/users/gebulmer/followers","following_url":"https://api.github.com/users/gebulmer/following{/other_user}","gists_url":"https://api.github.com/users/gebulmer/gists{/gist_id}","starred_url":"https://api.github.com/users/gebulmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebulmer/subscriptions","organizations_url":"https://api.github.com/users/gebulmer/orgs","repos_url":"https://api.github.com/users/gebulmer/repos","events_url":"https://api.github.com/users/gebulmer/events{/privacy}","received_events_url":"https://api.github.com/users/gebulmer/received_events","type":"User","site_admin":false},"body":"In testing for success, it is ran twice, the second time without a signal to test it kept the url.\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/qutebrowser/qutebrowser/3594)\r\n<!-- Reviewable:end -->\r\n","created_at":"2018-02-13T13:34:58Z","updated_at":"2018-02-13T16:54:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41005509af2ff32f2939de9b1c348a1e994c4432","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":708435425,"url":"https://api.github.com/repos/qutebrowser/qutebrowser/labels/status:%20needs%20review","name":"status: needs review","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594/commits","review_comments_url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594/comments","review_comment_url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qutebrowser/qutebrowser/issues/3594/comments","statuses_url":"https://api.github.com/repos/qutebrowser/qutebrowser/statuses/cfa779ecb7b417191f8596209a7f461a0d1f7317","head":{"label":"gebulmer:testpaste","ref":"testpaste","sha":"cfa779ecb7b417191f8596209a7f461a0d1f7317","user":{"login":"gebulmer","id":32779206,"avatar_url":"https://avatars3.githubusercontent.com/u/32779206?v=4","gravatar_id":"","url":"https://api.github.com/users/gebulmer","html_url":"https://github.com/gebulmer","followers_url":"https://api.github.com/users/gebulmer/followers","following_url":"https://api.github.com/users/gebulmer/following{/other_user}","gists_url":"https://api.github.com/users/gebulmer/gists{/gist_id}","starred_url":"https://api.github.com/users/gebulmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebulmer/subscriptions","organizations_url":"https://api.github.com/users/gebulmer/orgs","repos_url":"https://api.github.com/users/gebulmer/repos","events_url":"https://api.github.com/users/gebulmer/events{/privacy}","received_events_url":"https://api.github.com/users/gebulmer/received_events","type":"User","site_admin":false},"repo":{"id":113507775,"name":"qutebrowser","full_name":"gebulmer/qutebrowser","owner":{"login":"gebulmer","id":32779206,"avatar_url":"https://avatars3.githubusercontent.com/u/32779206?v=4","gravatar_id":"","url":"https://api.github.com/users/gebulmer","html_url":"https://github.com/gebulmer","followers_url":"https://api.github.com/users/gebulmer/followers","following_url":"https://api.github.com/users/gebulmer/following{/other_user}","gists_url":"https://api.github.com/users/gebulmer/gists{/gist_id}","starred_url":"https://api.github.com/users/gebulmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebulmer/subscriptions","organizations_url":"https://api.github.com/users/gebulmer/orgs","repos_url":"https://api.github.com/users/gebulmer/repos","events_url":"https://api.github.com/users/gebulmer/events{/privacy}","received_events_url":"https://api.github.com/users/gebulmer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gebulmer/qutebrowser","description":"A keyboard-driven, vim-like browser based on PyQt5.","fork":true,"url":"https://api.github.com/repos/gebulmer/qutebrowser","forks_url":"https://api.github.com/repos/gebulmer/qutebrowser/forks","keys_url":"https://api.github.com/repos/gebulmer/qutebrowser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gebulmer/qutebrowser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gebulmer/qutebrowser/teams","hooks_url":"https://api.github.com/repos/gebulmer/qutebrowser/hooks","issue_events_url":"https://api.github.com/repos/gebulmer/qutebrowser/issues/events{/number}","events_url":"https://api.github.com/repos/gebulmer/qutebrowser/events","assignees_url":"https://api.github.com/repos/gebulmer/qutebrowser/assignees{/user}","branches_url":"https://api.github.com/repos/gebulmer/qutebrowser/branches{/branch}","tags_url":"https://api.github.com/repos/gebulmer/qutebrowser/tags","blobs_url":"https://api.github.com/repos/gebulmer/qutebrowser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gebulmer/qutebrowser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gebulmer/qutebrowser/git/refs{/sha}","trees_url":"https://api.github.com/repos/gebulmer/qutebrowser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gebulmer/qutebrowser/statuses/{sha}","languages_url":"https://api.github.com/repos/gebulmer/qutebrowser/languages","stargazers_url":"https://api.github.com/repos/gebulmer/qutebrowser/stargazers","contributors_url":"https://api.github.com/repos/gebulmer/qutebrowser/contributors","subscribers_url":"https://api.github.com/repos/gebulmer/qutebrowser/subscribers","subscription_url":"https://api.github.com/repos/gebulmer/qutebrowser/subscription","commits_url":"https://api.github.com/repos/gebulmer/qutebrowser/commits{/sha}","git_commits_url":"https://api.github.com/repos/gebulmer/qutebrowser/git/commits{/sha}","comments_url":"https://api.github.com/repos/gebulmer/qutebrowser/comments{/number}","issue_comment_url":"https://api.github.com/repos/gebulmer/qutebrowser/issues/comments{/number}","contents_url":"https://api.github.com/repos/gebulmer/qutebrowser/contents/{+path}","compare_url":"https://api.github.com/repos/gebulmer/qutebrowser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gebulmer/qutebrowser/merges","archive_url":"https://api.github.com/repos/gebulmer/qutebrowser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gebulmer/qutebrowser/downloads","issues_url":"https://api.github.com/repos/gebulmer/qutebrowser/issues{/number}","pulls_url":"https://api.github.com/repos/gebulmer/qutebrowser/pulls{/number}","milestones_url":"https://api.github.com/repos/gebulmer/qutebrowser/milestones{/number}","notifications_url":"https://api.github.com/repos/gebulmer/qutebrowser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gebulmer/qutebrowser/labels{/name}","releases_url":"https://api.github.com/repos/gebulmer/qutebrowser/releases{/id}","deployments_url":"https://api.github.com/repos/gebulmer/qutebrowser/deployments","created_at":"2017-12-07T23:11:19Z","updated_at":"2017-12-07T23:11:22Z","pushed_at":"2018-02-13T16:02:40Z","git_url":"git://github.com/gebulmer/qutebrowser.git","ssh_url":"git@github.com:gebulmer/qutebrowser.git","clone_url":"https://github.com/gebulmer/qutebrowser.git","svn_url":"https://github.com/gebulmer/qutebrowser","homepage":"https://www.qutebrowser.org/","size":29229,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"qutebrowser:master","ref":"master","sha":"171392b582e30ba5f17344e618cd3d0c68429150","user":{"login":"qutebrowser","id":21955151,"avatar_url":"https://avatars1.githubusercontent.com/u/21955151?v=4","gravatar_id":"","url":"https://api.github.com/users/qutebrowser","html_url":"https://github.com/qutebrowser","followers_url":"https://api.github.com/users/qutebrowser/followers","following_url":"https://api.github.com/users/qutebrowser/following{/other_user}","gists_url":"https://api.github.com/users/qutebrowser/gists{/gist_id}","starred_url":"https://api.github.com/users/qutebrowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qutebrowser/subscriptions","organizations_url":"https://api.github.com/users/qutebrowser/orgs","repos_url":"https://api.github.com/users/qutebrowser/repos","events_url":"https://api.github.com/users/qutebrowser/events{/privacy}","received_events_url":"https://api.github.com/users/qutebrowser/received_events","type":"Organization","site_admin":false},"repo":{"id":21244505,"name":"qutebrowser","full_name":"qutebrowser/qutebrowser","owner":{"login":"qutebrowser","id":21955151,"avatar_url":"https://avatars1.githubusercontent.com/u/21955151?v=4","gravatar_id":"","url":"https://api.github.com/users/qutebrowser","html_url":"https://github.com/qutebrowser","followers_url":"https://api.github.com/users/qutebrowser/followers","following_url":"https://api.github.com/users/qutebrowser/following{/other_user}","gists_url":"https://api.github.com/users/qutebrowser/gists{/gist_id}","starred_url":"https://api.github.com/users/qutebrowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qutebrowser/subscriptions","organizations_url":"https://api.github.com/users/qutebrowser/orgs","repos_url":"https://api.github.com/users/qutebrowser/repos","events_url":"https://api.github.com/users/qutebrowser/events{/privacy}","received_events_url":"https://api.github.com/users/qutebrowser/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qutebrowser/qutebrowser","description":"A keyboard-driven, vim-like browser based on PyQt5.","fork":false,"url":"https://api.github.com/repos/qutebrowser/qutebrowser","forks_url":"https://api.github.com/repos/qutebrowser/qutebrowser/forks","keys_url":"https://api.github.com/repos/qutebrowser/qutebrowser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qutebrowser/qutebrowser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qutebrowser/qutebrowser/teams","hooks_url":"https://api.github.com/repos/qutebrowser/qutebrowser/hooks","issue_events_url":"https://api.github.com/repos/qutebrowser/qutebrowser/issues/events{/number}","events_url":"https://api.github.com/repos/qutebrowser/qutebrowser/events","assignees_url":"https://api.github.com/repos/qutebrowser/qutebrowser/assignees{/user}","branches_url":"https://api.github.com/repos/qutebrowser/qutebrowser/branches{/branch}","tags_url":"https://api.github.com/repos/qutebrowser/qutebrowser/tags","blobs_url":"https://api.github.com/repos/qutebrowser/qutebrowser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qutebrowser/qutebrowser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qutebrowser/qutebrowser/git/refs{/sha}","trees_url":"https://api.github.com/repos/qutebrowser/qutebrowser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qutebrowser/qutebrowser/statuses/{sha}","languages_url":"https://api.github.com/repos/qutebrowser/qutebrowser/languages","stargazers_url":"https://api.github.com/repos/qutebrowser/qutebrowser/stargazers","contributors_url":"https://api.github.com/repos/qutebrowser/qutebrowser/contributors","subscribers_url":"https://api.github.com/repos/qutebrowser/qutebrowser/subscribers","subscription_url":"https://api.github.com/repos/qutebrowser/qutebrowser/subscription","commits_url":"https://api.github.com/repos/qutebrowser/qutebrowser/commits{/sha}","git_commits_url":"https://api.github.com/repos/qutebrowser/qutebrowser/git/commits{/sha}","comments_url":"https://api.github.com/repos/qutebrowser/qutebrowser/comments{/number}","issue_comment_url":"https://api.github.com/repos/qutebrowser/qutebrowser/issues/comments{/number}","contents_url":"https://api.github.com/repos/qutebrowser/qutebrowser/contents/{+path}","compare_url":"https://api.github.com/repos/qutebrowser/qutebrowser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qutebrowser/qutebrowser/merges","archive_url":"https://api.github.com/repos/qutebrowser/qutebrowser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qutebrowser/qutebrowser/downloads","issues_url":"https://api.github.com/repos/qutebrowser/qutebrowser/issues{/number}","pulls_url":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls{/number}","milestones_url":"https://api.github.com/repos/qutebrowser/qutebrowser/milestones{/number}","notifications_url":"https://api.github.com/repos/qutebrowser/qutebrowser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qutebrowser/qutebrowser/labels{/name}","releases_url":"https://api.github.com/repos/qutebrowser/qutebrowser/releases{/id}","deployments_url":"https://api.github.com/repos/qutebrowser/qutebrowser/deployments","created_at":"2014-06-26T14:59:34Z","updated_at":"2018-02-13T16:53:27Z","pushed_at":"2018-02-13T16:02:48Z","git_url":"git://github.com/qutebrowser/qutebrowser.git","ssh_url":"git@github.com:qutebrowser/qutebrowser.git","clone_url":"https://github.com/qutebrowser/qutebrowser.git","svn_url":"https://github.com/qutebrowser/qutebrowser","homepage":"https://www.qutebrowser.org/","size":30649,"stargazers_count":3078,"watchers_count":3078,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":426,"mirror_url":null,"archived":false,"open_issues_count":533,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":426,"open_issues":533,"watchers":3078,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594"},"html":{"href":"https://github.com/qutebrowser/qutebrowser/pull/3594"},"issue":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/issues/3594"},"comments":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/issues/3594/comments"},"review_comments":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594/comments"},"review_comment":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/pulls/3594/commits"},"statuses":{"href":"https://api.github.com/repos/qutebrowser/qutebrowser/statuses/cfa779ecb7b417191f8596209a7f461a0d1f7317"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"The-Compiler"}}