{"action":"created","comment":{"url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/comments/178028922","pull_request_review_id":108014176,"id":178028922,"diff_hunk":"@@ -483,36 +693,70 @@ def test_upload_file_remote_info_not_none_invalid_metadata_with_desc(self):\n                                  'info_not_none_invalid_metadata_with_' +\n                                  'desc.yaml') as cass:\n             with self.assertRaises(Exception):\n-                with patch('__main__.open', mock_open(), create=True):\n-                    with open('foo', 'w') as h:\n-                        h.write('some stuff')\n-                    upload_file(target_filepath='foo',\n+                with patch('%s.open' % __name__, mock_open(), create=True):\n+                    with patch('ohapi.api.open', mock_open(), create=True):\n+                        try:\n+                            filename = 'foo'\n+\n+                            def fake_stat(arg):\n+                                if arg == filename:\n+                                    faked = list(orig_os_stat('/tmp'))\n+                                    faked[stat.ST_SIZE] = len('some stuff')\n+                                    return stat_result(faked)\n+                                else:\n+                                    return orig_os_stat(arg)\n+                            orig_os_stat = os.stat\n+                            os.stat = fake_stat\n+                            with open('foo', 'w') as h:\n+                                h.write('some stuff')\n+                            upload_file(\n+                                target_filepath='foo',\n                                 metadata=FILE_METADATA_INVALID_WITH_DESC,\n                                 access_token=ACCESS_TOKEN,\n                                 project_member_id=VALID_PMI1,\n                                 remote_file_info=REMOTE_FILE_INFO)\n-                    self.assertEqual(cass.responses[0][\"status\"][\"code\"], 200)\n-                    self.assertEqual(\n-                        cass.responses[1][\"body\"][\"string\"]\n-                        .decode('utf-8'),\n-                        '{\"metadata\":[\"\\\\\"tags\\\\\" is a required ' +\n-                        'field of the metadata\"]}')\n+                            self.assertEqual(cass.responses[0][\n+                                             \"status\"][\"code\"], 200)\n+                            self.assertEqual(\n+                                cass.responses[1][\"body\"][\"string\"]\n+                                .decode('utf-8'),\n+                                '{\"metadata\":[\"\\\\\"tags\\\\\" is a required ' +\n+                                'field of the metadata\"]}')\n+                        finally:\n+                            os.stat = orig_os_stat\n \n     def test_upload_file_remote_info_not_none_invalid_metadata(self):\n         with my_vcr.use_cassette(\n                 'ohapi/cassettes/test_upload_file_remote_in' +\n                 'fo_not_none_invalid_metadata.yaml') as cass:\n             with self.assertRaises(Exception):\n-                with patch('__main__.open', mock_open(), create=True):\n-                    with open('foo', 'w') as h:\n-                        h.write('some stuff')\n-                    upload_file(target_filepath='foo',\n-                                metadata=FILE_METADATA_INVALID,\n-                                access_token=ACCESS_TOKEN,\n-                                project_member_id=VALID_PMI1,\n-                                remote_file_info=REMOTE_FILE_INFO)\n-                    self.assertEqual(cass.responses[0][\"status\"][\"code\"], 200)\n-                    self.assertEqual(cass.responses[1][\"body\"][\"string\"]\n-                                     .decode('utf-8'),\n-                                     '{\"metadata\":[\"\\\\\"description\\\\\" is a ' +\n-                                     'required field of the metadata\"]}')\n+                with patch('%s.open' % __name__, mock_open(), create=True):\n+                    with patch('ohapi.api.open', mock_open(), create=True):\n+                        try:\n+                            filename = 'foo'\n+\n+                            def fake_stat(arg):\n+                                if arg == filename:\n+                                    faked = list(orig_os_stat('/tmp'))\n+                                    faked[stat.ST_SIZE] = len('some stuff')\n+                                    return stat_result(faked)\n+                                else:\n+                                    return orig_os_stat(arg)\n+                            orig_os_stat = os.stat\n+                            os.stat = fake_stat\n+                            with open('foo', 'w') as h:\n+                                h.write('some stuff')\n+                            upload_file(target_filepath='foo',\n+                                        metadata=FILE_METADATA_INVALID,\n+                                        access_token=ACCESS_TOKEN,\n+                                        project_member_id=VALID_PMI1,","path":"ohapi/tests/test_api.py","position":641,"original_position":641,"commit_id":"dd37f71579a61251da7d600acd6baa25e42b1290","original_commit_id":"dd37f71579a61251da7d600acd6baa25e42b1290","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"undefined name 'VALID_PMI1'","created_at":"2018-03-29T11:36:25Z","updated_at":"2018-03-29T11:36:27Z","html_url":"https://github.com/OpenHumans/open-humans-api/pull/31#discussion_r178028922","pull_request_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/comments/178028922"},"html":{"href":"https://github.com/OpenHumans/open-humans-api/pull/31#discussion_r178028922"},"pull_request":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31","id":172689864,"html_url":"https://github.com/OpenHumans/open-humans-api/pull/31","diff_url":"https://github.com/OpenHumans/open-humans-api/pull/31.diff","patch_url":"https://github.com/OpenHumans/open-humans-api/pull/31.patch","issue_url":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/31","number":31,"state":"open","locked":false,"title":"Updated upload function to use AWS S3","user":{"login":"kritisingh1","id":22004158,"avatar_url":"https://avatars2.githubusercontent.com/u/22004158?v=4","gravatar_id":"","url":"https://api.github.com/users/kritisingh1","html_url":"https://github.com/kritisingh1","followers_url":"https://api.github.com/users/kritisingh1/followers","following_url":"https://api.github.com/users/kritisingh1/following{/other_user}","gists_url":"https://api.github.com/users/kritisingh1/gists{/gist_id}","starred_url":"https://api.github.com/users/kritisingh1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kritisingh1/subscriptions","organizations_url":"https://api.github.com/users/kritisingh1/orgs","repos_url":"https://api.github.com/users/kritisingh1/repos","events_url":"https://api.github.com/users/kritisingh1/events{/privacy}","received_events_url":"https://api.github.com/users/kritisingh1/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above -->\r\nCloses #4 \r\n## General Checkups\r\n- [x] Have you checked that there aren't other open pull requests for the same issue/update/change?\r\n- [ ] If your code includes new features and not just bug fixes/copy editing: Did you include new tests?\r\n\r\n<!---\r\nby the way: if you want to discuss feature requests and bugs with us before submitting anything on GitHub: We're always happy to chat on Slack: http://slackin.openhumans.org/\r\n -->\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\nLarge file uploads can be done using AWS S3\r\n\r\n## Related Issue\r\n<!--- if this closes an issue make sure include e.g., \"fix #4\"\r\nor similar - or if just relates to an issue make sure to mention\r\nit like \"#4\" -->\r\n\r\n## Example\r\n<!--- if introducing a new feature or changing behavior of existing\r\nmethods/functions, include an example if possible to do in brief form -->\r\n\r\n<!--- Did you remember to include tests? Unless you're just changing\r\ngrammar, please include new tests for your change -->\r\n","created_at":"2018-03-03T22:04:23Z","updated_at":"2018-03-29T11:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6179706485bfc70d9b1f80aaf0d2368d55035fe3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31/commits","review_comments_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31/comments","review_comment_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/31/comments","statuses_url":"https://api.github.com/repos/OpenHumans/open-humans-api/statuses/dd37f71579a61251da7d600acd6baa25e42b1290","head":{"label":"kritisingh1:upload-function","ref":"upload-function","sha":"dd37f71579a61251da7d600acd6baa25e42b1290","user":{"login":"kritisingh1","id":22004158,"avatar_url":"https://avatars2.githubusercontent.com/u/22004158?v=4","gravatar_id":"","url":"https://api.github.com/users/kritisingh1","html_url":"https://github.com/kritisingh1","followers_url":"https://api.github.com/users/kritisingh1/followers","following_url":"https://api.github.com/users/kritisingh1/following{/other_user}","gists_url":"https://api.github.com/users/kritisingh1/gists{/gist_id}","starred_url":"https://api.github.com/users/kritisingh1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kritisingh1/subscriptions","organizations_url":"https://api.github.com/users/kritisingh1/orgs","repos_url":"https://api.github.com/users/kritisingh1/repos","events_url":"https://api.github.com/users/kritisingh1/events{/privacy}","received_events_url":"https://api.github.com/users/kritisingh1/received_events","type":"User","site_admin":false},"repo":{"id":122904035,"name":"open-humans-api","full_name":"kritisingh1/open-humans-api","owner":{"login":"kritisingh1","id":22004158,"avatar_url":"https://avatars2.githubusercontent.com/u/22004158?v=4","gravatar_id":"","url":"https://api.github.com/users/kritisingh1","html_url":"https://github.com/kritisingh1","followers_url":"https://api.github.com/users/kritisingh1/followers","following_url":"https://api.github.com/users/kritisingh1/following{/other_user}","gists_url":"https://api.github.com/users/kritisingh1/gists{/gist_id}","starred_url":"https://api.github.com/users/kritisingh1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kritisingh1/subscriptions","organizations_url":"https://api.github.com/users/kritisingh1/orgs","repos_url":"https://api.github.com/users/kritisingh1/repos","events_url":"https://api.github.com/users/kritisingh1/events{/privacy}","received_events_url":"https://api.github.com/users/kritisingh1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kritisingh1/open-humans-api","description":"Tools to work with our APIs.","fork":true,"url":"https://api.github.com/repos/kritisingh1/open-humans-api","forks_url":"https://api.github.com/repos/kritisingh1/open-humans-api/forks","keys_url":"https://api.github.com/repos/kritisingh1/open-humans-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kritisingh1/open-humans-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kritisingh1/open-humans-api/teams","hooks_url":"https://api.github.com/repos/kritisingh1/open-humans-api/hooks","issue_events_url":"https://api.github.com/repos/kritisingh1/open-humans-api/issues/events{/number}","events_url":"https://api.github.com/repos/kritisingh1/open-humans-api/events","assignees_url":"https://api.github.com/repos/kritisingh1/open-humans-api/assignees{/user}","branches_url":"https://api.github.com/repos/kritisingh1/open-humans-api/branches{/branch}","tags_url":"https://api.github.com/repos/kritisingh1/open-humans-api/tags","blobs_url":"https://api.github.com/repos/kritisingh1/open-humans-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kritisingh1/open-humans-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kritisingh1/open-humans-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/kritisingh1/open-humans-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kritisingh1/open-humans-api/statuses/{sha}","languages_url":"https://api.github.com/repos/kritisingh1/open-humans-api/languages","stargazers_url":"https://api.github.com/repos/kritisingh1/open-humans-api/stargazers","contributors_url":"https://api.github.com/repos/kritisingh1/open-humans-api/contributors","subscribers_url":"https://api.github.com/repos/kritisingh1/open-humans-api/subscribers","subscription_url":"https://api.github.com/repos/kritisingh1/open-humans-api/subscription","commits_url":"https://api.github.com/repos/kritisingh1/open-humans-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/kritisingh1/open-humans-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/kritisingh1/open-humans-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/kritisingh1/open-humans-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/kritisingh1/open-humans-api/contents/{+path}","compare_url":"https://api.github.com/repos/kritisingh1/open-humans-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kritisingh1/open-humans-api/merges","archive_url":"https://api.github.com/repos/kritisingh1/open-humans-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kritisingh1/open-humans-api/downloads","issues_url":"https://api.github.com/repos/kritisingh1/open-humans-api/issues{/number}","pulls_url":"https://api.github.com/repos/kritisingh1/open-humans-api/pulls{/number}","milestones_url":"https://api.github.com/repos/kritisingh1/open-humans-api/milestones{/number}","notifications_url":"https://api.github.com/repos/kritisingh1/open-humans-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kritisingh1/open-humans-api/labels{/name}","releases_url":"https://api.github.com/repos/kritisingh1/open-humans-api/releases{/id}","deployments_url":"https://api.github.com/repos/kritisingh1/open-humans-api/deployments","created_at":"2018-02-26T02:53:00Z","updated_at":"2018-03-26T12:34:14Z","pushed_at":"2018-03-29T11:36:13Z","git_url":"git://github.com/kritisingh1/open-humans-api.git","ssh_url":"git@github.com:kritisingh1/open-humans-api.git","clone_url":"https://github.com/kritisingh1/open-humans-api.git","svn_url":"https://github.com/kritisingh1/open-humans-api","homepage":null,"size":178,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenHumans:master","ref":"master","sha":"ea3f9836fc0a5103ef9706f3507b93821d9beffc","user":{"login":"OpenHumans","id":3341265,"avatar_url":"https://avatars3.githubusercontent.com/u/3341265?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenHumans","html_url":"https://github.com/OpenHumans","followers_url":"https://api.github.com/users/OpenHumans/followers","following_url":"https://api.github.com/users/OpenHumans/following{/other_user}","gists_url":"https://api.github.com/users/OpenHumans/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenHumans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenHumans/subscriptions","organizations_url":"https://api.github.com/users/OpenHumans/orgs","repos_url":"https://api.github.com/users/OpenHumans/repos","events_url":"https://api.github.com/users/OpenHumans/events{/privacy}","received_events_url":"https://api.github.com/users/OpenHumans/received_events","type":"Organization","site_admin":false},"repo":{"id":65763791,"name":"open-humans-api","full_name":"OpenHumans/open-humans-api","owner":{"login":"OpenHumans","id":3341265,"avatar_url":"https://avatars3.githubusercontent.com/u/3341265?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenHumans","html_url":"https://github.com/OpenHumans","followers_url":"https://api.github.com/users/OpenHumans/followers","following_url":"https://api.github.com/users/OpenHumans/following{/other_user}","gists_url":"https://api.github.com/users/OpenHumans/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenHumans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenHumans/subscriptions","organizations_url":"https://api.github.com/users/OpenHumans/orgs","repos_url":"https://api.github.com/users/OpenHumans/repos","events_url":"https://api.github.com/users/OpenHumans/events{/privacy}","received_events_url":"https://api.github.com/users/OpenHumans/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenHumans/open-humans-api","description":"Tools to work with our APIs.","fork":false,"url":"https://api.github.com/repos/OpenHumans/open-humans-api","forks_url":"https://api.github.com/repos/OpenHumans/open-humans-api/forks","keys_url":"https://api.github.com/repos/OpenHumans/open-humans-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenHumans/open-humans-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenHumans/open-humans-api/teams","hooks_url":"https://api.github.com/repos/OpenHumans/open-humans-api/hooks","issue_events_url":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/events{/number}","events_url":"https://api.github.com/repos/OpenHumans/open-humans-api/events","assignees_url":"https://api.github.com/repos/OpenHumans/open-humans-api/assignees{/user}","branches_url":"https://api.github.com/repos/OpenHumans/open-humans-api/branches{/branch}","tags_url":"https://api.github.com/repos/OpenHumans/open-humans-api/tags","blobs_url":"https://api.github.com/repos/OpenHumans/open-humans-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenHumans/open-humans-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenHumans/open-humans-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenHumans/open-humans-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenHumans/open-humans-api/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenHumans/open-humans-api/languages","stargazers_url":"https://api.github.com/repos/OpenHumans/open-humans-api/stargazers","contributors_url":"https://api.github.com/repos/OpenHumans/open-humans-api/contributors","subscribers_url":"https://api.github.com/repos/OpenHumans/open-humans-api/subscribers","subscription_url":"https://api.github.com/repos/OpenHumans/open-humans-api/subscription","commits_url":"https://api.github.com/repos/OpenHumans/open-humans-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenHumans/open-humans-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenHumans/open-humans-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenHumans/open-humans-api/contents/{+path}","compare_url":"https://api.github.com/repos/OpenHumans/open-humans-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenHumans/open-humans-api/merges","archive_url":"https://api.github.com/repos/OpenHumans/open-humans-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenHumans/open-humans-api/downloads","issues_url":"https://api.github.com/repos/OpenHumans/open-humans-api/issues{/number}","pulls_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenHumans/open-humans-api/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenHumans/open-humans-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenHumans/open-humans-api/labels{/name}","releases_url":"https://api.github.com/repos/OpenHumans/open-humans-api/releases{/id}","deployments_url":"https://api.github.com/repos/OpenHumans/open-humans-api/deployments","created_at":"2016-08-15T20:44:53Z","updated_at":"2018-03-28T16:32:12Z","pushed_at":"2018-03-29T11:36:14Z","git_url":"git://github.com/OpenHumans/open-humans-api.git","ssh_url":"git@github.com:OpenHumans/open-humans-api.git","clone_url":"https://github.com/OpenHumans/open-humans-api.git","svn_url":"https://github.com/OpenHumans/open-humans-api","homepage":null,"size":149,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":13,"open_issues":9,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31"},"html":{"href":"https://github.com/OpenHumans/open-humans-api/pull/31"},"issue":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/31"},"comments":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/statuses/dd37f71579a61251da7d600acd6baa25e42b1290"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}