{"action":"created","comment":{"url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/comments/206530854","pull_request_review_id":141953506,"id":206530854,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjUzMDg1NA==","diff_hunk":"@@ -24,63 +48,212 @@ def test_version():\n         sys.argv = tmp\n \n \n-@patch('insights.client.client.constants.sleep_time', 0)\n-@patch('insights.client.client.InsightsConnection.upload_archive',\n-       return_value=Mock(status_code=500))\n-def test_upload_500_retry(upload_archive):\n+def test_register():\n+    config = InsightsConfig(register=True)\n+    client = InsightsClient(config)\n+    client.connection = FakeConnection()\n+    client.session = True\n+    assert client.register() is True","path":"insights/tests/client/test_client.py","position":50,"original_position":50,"commit_id":"6f4806b086cf8914181fe4dce1499b433a5a9cf2","original_commit_id":"6f4806b086cf8914181fe4dce1499b433a5a9cf2","user":{"login":"Glutexo","id":1161096,"node_id":"MDQ6VXNlcjExNjEwOTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1161096?v=4","gravatar_id":"","url":"https://api.github.com/users/Glutexo","html_url":"https://github.com/Glutexo","followers_url":"https://api.github.com/users/Glutexo/followers","following_url":"https://api.github.com/users/Glutexo/following{/other_user}","gists_url":"https://api.github.com/users/Glutexo/gists{/gist_id}","starred_url":"https://api.github.com/users/Glutexo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glutexo/subscriptions","organizations_url":"https://api.github.com/users/Glutexo/orgs","repos_url":"https://api.github.com/users/Glutexo/repos","events_url":"https://api.github.com/users/Glutexo/events{/privacy}","received_events_url":"https://api.github.com/users/Glutexo/received_events","type":"User","site_admin":false},"body":"Without any mocking here, we are touching the real filesystem. The tests are actually reading and **writing** files in the real _/etc_. That’s really bad. Not only in would need either root access or some special permissions setup, but more importantly it breaks out of the sandbox, doing mess in a real system.","created_at":"2018-07-31T13:39:10Z","updated_at":"2018-07-31T13:42:24Z","html_url":"https://github.com/RedHatInsights/insights-core/pull/1279#discussion_r206530854","pull_request_url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/comments/206530854"},"html":{"href":"https://github.com/RedHatInsights/insights-core/pull/1279#discussion_r206530854"},"pull_request":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279"}}},"pull_request":{"url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279","id":202660448,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyNjYwNDQ4","html_url":"https://github.com/RedHatInsights/insights-core/pull/1279","diff_url":"https://github.com/RedHatInsights/insights-core/pull/1279.diff","patch_url":"https://github.com/RedHatInsights/insights-core/pull/1279.patch","issue_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues/1279","number":1279,"state":"open","locked":false,"title":"Fix unregister on timeout","user":{"login":"gravitypriest","id":11755952,"node_id":"MDQ6VXNlcjExNzU1OTUy","avatar_url":"https://avatars1.githubusercontent.com/u/11755952?v=4","gravatar_id":"","url":"https://api.github.com/users/gravitypriest","html_url":"https://github.com/gravitypriest","followers_url":"https://api.github.com/users/gravitypriest/followers","following_url":"https://api.github.com/users/gravitypriest/following{/other_user}","gists_url":"https://api.github.com/users/gravitypriest/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitypriest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitypriest/subscriptions","organizations_url":"https://api.github.com/users/gravitypriest/orgs","repos_url":"https://api.github.com/users/gravitypriest/repos","events_url":"https://api.github.com/users/gravitypriest/events{/privacy}","received_events_url":"https://api.github.com/users/gravitypriest/received_events","type":"User","site_admin":false},"body":"This began as simply fixing the dotfiles being erased on timeout and turned into so much more...\r\n\r\nEnded up refactoring registration functions a bit. I modified some of the \"vision\" functions as some of them were either incompletely implemented or copied code from elsewhere that was being unused.\r\n\r\nAlso removed the connection singleton due to an issue where its config was stale; the config in the connection class was a different object than the one it was initialized with. Moved the connection persistence to the `InsightsClient` class instead. Used a decorator to mark any methods that need network functionality. Also added an `http_timeout` option.\r\n\r\nFinally, tests! I wanted to make sure registration was still behaving as intended.\r\n\r\nThere's a lot of passing of connection along with config now, and I'd like to refactor some more at some point (maybe move stuff from client.py to __init__.py) but that's a philosophical question for another day.","created_at":"2018-07-19T19:28:04Z","updated_at":"2018-07-31T13:42:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64ed08a23f174f3fc7ec0358f914c8574ca5e997","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":746536062,"node_id":"MDU6TGFiZWw3NDY1MzYwNjI=","url":"https://api.github.com/repos/RedHatInsights/insights-core/labels/client","name":"client","color":"5319e7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279/commits","review_comments_url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279/comments","review_comment_url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues/1279/comments","statuses_url":"https://api.github.com/repos/RedHatInsights/insights-core/statuses/6f4806b086cf8914181fe4dce1499b433a5a9cf2","head":{"label":"RedHatInsights:fix-unregister-on-timeout","ref":"fix-unregister-on-timeout","sha":"6f4806b086cf8914181fe4dce1499b433a5a9cf2","user":{"login":"RedHatInsights","id":24939818,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTM5ODE4","avatar_url":"https://avatars2.githubusercontent.com/u/24939818?v=4","gravatar_id":"","url":"https://api.github.com/users/RedHatInsights","html_url":"https://github.com/RedHatInsights","followers_url":"https://api.github.com/users/RedHatInsights/followers","following_url":"https://api.github.com/users/RedHatInsights/following{/other_user}","gists_url":"https://api.github.com/users/RedHatInsights/gists{/gist_id}","starred_url":"https://api.github.com/users/RedHatInsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RedHatInsights/subscriptions","organizations_url":"https://api.github.com/users/RedHatInsights/orgs","repos_url":"https://api.github.com/users/RedHatInsights/repos","events_url":"https://api.github.com/users/RedHatInsights/events{/privacy}","received_events_url":"https://api.github.com/users/RedHatInsights/received_events","type":"Organization","site_admin":false},"repo":{"id":92518221,"node_id":"MDEwOlJlcG9zaXRvcnk5MjUxODIyMQ==","name":"insights-core","full_name":"RedHatInsights/insights-core","owner":{"login":"RedHatInsights","id":24939818,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTM5ODE4","avatar_url":"https://avatars2.githubusercontent.com/u/24939818?v=4","gravatar_id":"","url":"https://api.github.com/users/RedHatInsights","html_url":"https://github.com/RedHatInsights","followers_url":"https://api.github.com/users/RedHatInsights/followers","following_url":"https://api.github.com/users/RedHatInsights/following{/other_user}","gists_url":"https://api.github.com/users/RedHatInsights/gists{/gist_id}","starred_url":"https://api.github.com/users/RedHatInsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RedHatInsights/subscriptions","organizations_url":"https://api.github.com/users/RedHatInsights/orgs","repos_url":"https://api.github.com/users/RedHatInsights/repos","events_url":"https://api.github.com/users/RedHatInsights/events{/privacy}","received_events_url":"https://api.github.com/users/RedHatInsights/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RedHatInsights/insights-core","description":"Insights Core is a data collection and processing framework used by Red Hat Insights","fork":false,"url":"https://api.github.com/repos/RedHatInsights/insights-core","forks_url":"https://api.github.com/repos/RedHatInsights/insights-core/forks","keys_url":"https://api.github.com/repos/RedHatInsights/insights-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RedHatInsights/insights-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RedHatInsights/insights-core/teams","hooks_url":"https://api.github.com/repos/RedHatInsights/insights-core/hooks","issue_events_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues/events{/number}","events_url":"https://api.github.com/repos/RedHatInsights/insights-core/events","assignees_url":"https://api.github.com/repos/RedHatInsights/insights-core/assignees{/user}","branches_url":"https://api.github.com/repos/RedHatInsights/insights-core/branches{/branch}","tags_url":"https://api.github.com/repos/RedHatInsights/insights-core/tags","blobs_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RedHatInsights/insights-core/statuses/{sha}","languages_url":"https://api.github.com/repos/RedHatInsights/insights-core/languages","stargazers_url":"https://api.github.com/repos/RedHatInsights/insights-core/stargazers","contributors_url":"https://api.github.com/repos/RedHatInsights/insights-core/contributors","subscribers_url":"https://api.github.com/repos/RedHatInsights/insights-core/subscribers","subscription_url":"https://api.github.com/repos/RedHatInsights/insights-core/subscription","commits_url":"https://api.github.com/repos/RedHatInsights/insights-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/RedHatInsights/insights-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/RedHatInsights/insights-core/contents/{+path}","compare_url":"https://api.github.com/repos/RedHatInsights/insights-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RedHatInsights/insights-core/merges","archive_url":"https://api.github.com/repos/RedHatInsights/insights-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RedHatInsights/insights-core/downloads","issues_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues{/number}","pulls_url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls{/number}","milestones_url":"https://api.github.com/repos/RedHatInsights/insights-core/milestones{/number}","notifications_url":"https://api.github.com/repos/RedHatInsights/insights-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RedHatInsights/insights-core/labels{/name}","releases_url":"https://api.github.com/repos/RedHatInsights/insights-core/releases{/id}","deployments_url":"https://api.github.com/repos/RedHatInsights/insights-core/deployments","created_at":"2017-05-26T14:23:11Z","updated_at":"2018-07-31T06:48:08Z","pushed_at":"2018-07-31T13:19:31Z","git_url":"git://github.com/RedHatInsights/insights-core.git","ssh_url":"git@github.com:RedHatInsights/insights-core.git","clone_url":"https://github.com/RedHatInsights/insights-core.git","svn_url":"https://github.com/RedHatInsights/insights-core","homepage":"https://access.redhat.com/insights","size":6307,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":19,"open_issues":81,"watchers":13,"default_branch":"master"}},"base":{"label":"RedHatInsights:master","ref":"master","sha":"e16b9a79964e645857490c1594d9f64ea2dfece3","user":{"login":"RedHatInsights","id":24939818,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTM5ODE4","avatar_url":"https://avatars2.githubusercontent.com/u/24939818?v=4","gravatar_id":"","url":"https://api.github.com/users/RedHatInsights","html_url":"https://github.com/RedHatInsights","followers_url":"https://api.github.com/users/RedHatInsights/followers","following_url":"https://api.github.com/users/RedHatInsights/following{/other_user}","gists_url":"https://api.github.com/users/RedHatInsights/gists{/gist_id}","starred_url":"https://api.github.com/users/RedHatInsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RedHatInsights/subscriptions","organizations_url":"https://api.github.com/users/RedHatInsights/orgs","repos_url":"https://api.github.com/users/RedHatInsights/repos","events_url":"https://api.github.com/users/RedHatInsights/events{/privacy}","received_events_url":"https://api.github.com/users/RedHatInsights/received_events","type":"Organization","site_admin":false},"repo":{"id":92518221,"node_id":"MDEwOlJlcG9zaXRvcnk5MjUxODIyMQ==","name":"insights-core","full_name":"RedHatInsights/insights-core","owner":{"login":"RedHatInsights","id":24939818,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0OTM5ODE4","avatar_url":"https://avatars2.githubusercontent.com/u/24939818?v=4","gravatar_id":"","url":"https://api.github.com/users/RedHatInsights","html_url":"https://github.com/RedHatInsights","followers_url":"https://api.github.com/users/RedHatInsights/followers","following_url":"https://api.github.com/users/RedHatInsights/following{/other_user}","gists_url":"https://api.github.com/users/RedHatInsights/gists{/gist_id}","starred_url":"https://api.github.com/users/RedHatInsights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RedHatInsights/subscriptions","organizations_url":"https://api.github.com/users/RedHatInsights/orgs","repos_url":"https://api.github.com/users/RedHatInsights/repos","events_url":"https://api.github.com/users/RedHatInsights/events{/privacy}","received_events_url":"https://api.github.com/users/RedHatInsights/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RedHatInsights/insights-core","description":"Insights Core is a data collection and processing framework used by Red Hat Insights","fork":false,"url":"https://api.github.com/repos/RedHatInsights/insights-core","forks_url":"https://api.github.com/repos/RedHatInsights/insights-core/forks","keys_url":"https://api.github.com/repos/RedHatInsights/insights-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RedHatInsights/insights-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RedHatInsights/insights-core/teams","hooks_url":"https://api.github.com/repos/RedHatInsights/insights-core/hooks","issue_events_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues/events{/number}","events_url":"https://api.github.com/repos/RedHatInsights/insights-core/events","assignees_url":"https://api.github.com/repos/RedHatInsights/insights-core/assignees{/user}","branches_url":"https://api.github.com/repos/RedHatInsights/insights-core/branches{/branch}","tags_url":"https://api.github.com/repos/RedHatInsights/insights-core/tags","blobs_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RedHatInsights/insights-core/statuses/{sha}","languages_url":"https://api.github.com/repos/RedHatInsights/insights-core/languages","stargazers_url":"https://api.github.com/repos/RedHatInsights/insights-core/stargazers","contributors_url":"https://api.github.com/repos/RedHatInsights/insights-core/contributors","subscribers_url":"https://api.github.com/repos/RedHatInsights/insights-core/subscribers","subscription_url":"https://api.github.com/repos/RedHatInsights/insights-core/subscription","commits_url":"https://api.github.com/repos/RedHatInsights/insights-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/RedHatInsights/insights-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/RedHatInsights/insights-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/RedHatInsights/insights-core/contents/{+path}","compare_url":"https://api.github.com/repos/RedHatInsights/insights-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RedHatInsights/insights-core/merges","archive_url":"https://api.github.com/repos/RedHatInsights/insights-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RedHatInsights/insights-core/downloads","issues_url":"https://api.github.com/repos/RedHatInsights/insights-core/issues{/number}","pulls_url":"https://api.github.com/repos/RedHatInsights/insights-core/pulls{/number}","milestones_url":"https://api.github.com/repos/RedHatInsights/insights-core/milestones{/number}","notifications_url":"https://api.github.com/repos/RedHatInsights/insights-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RedHatInsights/insights-core/labels{/name}","releases_url":"https://api.github.com/repos/RedHatInsights/insights-core/releases{/id}","deployments_url":"https://api.github.com/repos/RedHatInsights/insights-core/deployments","created_at":"2017-05-26T14:23:11Z","updated_at":"2018-07-31T06:48:08Z","pushed_at":"2018-07-31T13:19:31Z","git_url":"git://github.com/RedHatInsights/insights-core.git","ssh_url":"git@github.com:RedHatInsights/insights-core.git","clone_url":"https://github.com/RedHatInsights/insights-core.git","svn_url":"https://github.com/RedHatInsights/insights-core","homepage":"https://access.redhat.com/insights","size":6307,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":19,"open_issues":81,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279"},"html":{"href":"https://github.com/RedHatInsights/insights-core/pull/1279"},"issue":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/issues/1279"},"comments":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/issues/1279/comments"},"review_comments":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279/comments"},"review_comment":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/pulls/1279/commits"},"statuses":{"href":"https://api.github.com/repos/RedHatInsights/insights-core/statuses/6f4806b086cf8914181fe4dce1499b433a5a9cf2"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Glutexo"}}