{"action":"created","comment":{"url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/comments/173661156","pull_request_review_id":102888250,"id":173661156,"diff_hunk":"@@ -158,3 +167,64 @@ def test_get_page_invalid_access_token(self):\n         url = ('https://www.openhumans.org/api/direct-sharing/project/'\n                'exchange-member/?access_token={}'.format(\"invalid_token\"))\n         self.assertRaises(Exception, get_page, url)\n+\n+\n+class APITestMessage(TestCase):\n+\n+    def setUp(self):\n+        pass\n+    \n+    @my_vcr.use_cassette()\n+    def test_message_valid_access_token(self):\n+        response = message(subject=SUBJECT, message=MESSAGE,\n+                           access_token=ACCESS_TOKEN)\n+        self.assertEqual(response.status_code, 200)\n+\n+    @my_vcr.use_cassette()\n+    def test_message_expired_access_token(self):\n+        response = message(subject=SUBJECT, message=MESSAGE,\n+                           access_token=ACCESS_TOKEN_EXPIRED)\n+        assert response.json() == {\"detail\":\"Expired token.\"}\n+    \n+    @my_vcr.use_cassette()\n+    def test_message_invalid_access_token(self):\n+        response = message(subject=SUBJECT, message=MESSAGE,\n+                           access_token=ACCESS_TOKEN_INVALID)\n+        assert response.json() == {\"detail\":\"Invalid token.\"}\n+    \n+    @my_vcr.use_cassette()\n+    def test_message_all_members_true_project_member_id_none(self):\n+        response = message(all_members=True, subject=SUBJECT, message=MESSAGE,\n+                           access_token=ACCESS_TOKEN)\n+        self.assertEqual(response.status_code, 200)\n+\n+    @my_vcr.use_cassette()\n+    def test_message_all_members_true_project_member_id_not_none(self):\n+        self.assertRaises(Exception, message, all_members=True,\n+                          project_member_ids=['abcdef', 'sdf'],\n+                          subject=SUBJECT, message=MESSAGE,\n+                          access_token=ACCESS_TOKEN)\n+\n+    @my_vcr.use_cassette()\n+    def test_message_all_members_false_project_member_id_not_none_invalid_char(self):\n+        response = message(project_member_ids=['abcdef1', 'test'],\n+                           subject=SUBJECT, message=MESSAGE,\n+                           access_token=MASTER_ACCESS_TOKEN)\n+        assert response.json() == {\"errors\":{\"project_member_ids\":\n+                                  [\"Project member IDs are always 8\" +\n+                                   \" digits long.\"]}}\n+\n+    @my_vcr.use_cassette()\n+    def test_message_all_members_false_project_member_id_not_none_invalid_digit(self):\n+        response = message(project_member_ids=[INVALID_PMI1, INVALID_PMI2],\n+                           subject=SUBJECT, message=MESSAGE,\n+                           access_token=MASTER_ACCESS_TOKEN)\n+        assert response.json() == {\"errors\":{\"project_member_ids\":\n+                                  [\"Invalid project member ID(s): invalidPMI2\"]}}\n+\n+    @my_vcr.use_cassette()\n+    def test_message_all_members_false_project_member_id_not_none_valid(self):\n+        response = message(project_member_ids=[VALID_PMI1, VALID_PMI2],\n+                           subject=SUBJECT, message=MESSAGE,","path":"ohapi/tests/test_api.py","position":89,"original_position":89,"commit_id":"f2c516a66ca0120ac6e5e12d9af3a5562f6c1feb","original_commit_id":"f2c516a66ca0120ac6e5e12d9af3a5562f6c1feb","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 'SUBJECT'<br>undefined name 'MESSAGE'","created_at":"2018-03-11T16:42:19Z","updated_at":"2018-03-11T16:42:21Z","html_url":"https://github.com/OpenHumans/open-humans-api/pull/36#discussion_r173661156","pull_request_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/comments/173661156"},"html":{"href":"https://github.com/OpenHumans/open-humans-api/pull/36#discussion_r173661156"},"pull_request":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36","id":173304806,"html_url":"https://github.com/OpenHumans/open-humans-api/pull/36","diff_url":"https://github.com/OpenHumans/open-humans-api/pull/36.diff","patch_url":"https://github.com/OpenHumans/open-humans-api/pull/36.patch","issue_url":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/36","number":36,"state":"open","locked":false,"title":"Added tests for message function api","user":{"login":"DartingMelody","id":25335896,"avatar_url":"https://avatars0.githubusercontent.com/u/25335896?v=4","gravatar_id":"","url":"https://api.github.com/users/DartingMelody","html_url":"https://github.com/DartingMelody","followers_url":"https://api.github.com/users/DartingMelody/followers","following_url":"https://api.github.com/users/DartingMelody/following{/other_user}","gists_url":"https://api.github.com/users/DartingMelody/gists{/gist_id}","starred_url":"https://api.github.com/users/DartingMelody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartingMelody/subscriptions","organizations_url":"https://api.github.com/users/DartingMelody/orgs","repos_url":"https://api.github.com/users/DartingMelody/repos","events_url":"https://api.github.com/users/DartingMelody/events{/privacy}","received_events_url":"https://api.github.com/users/DartingMelody/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above -->\r\n\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- [x] 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\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-06T22:49:39Z","updated_at":"2018-03-11T16:42:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75ebf51c8f3d24363fa282de5c3493912ae1b196","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36/commits","review_comments_url":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36/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/36/comments","statuses_url":"https://api.github.com/repos/OpenHumans/open-humans-api/statuses/f2c516a66ca0120ac6e5e12d9af3a5562f6c1feb","head":{"label":"DartingMelody:test_message","ref":"test_message","sha":"f2c516a66ca0120ac6e5e12d9af3a5562f6c1feb","user":{"login":"DartingMelody","id":25335896,"avatar_url":"https://avatars0.githubusercontent.com/u/25335896?v=4","gravatar_id":"","url":"https://api.github.com/users/DartingMelody","html_url":"https://github.com/DartingMelody","followers_url":"https://api.github.com/users/DartingMelody/followers","following_url":"https://api.github.com/users/DartingMelody/following{/other_user}","gists_url":"https://api.github.com/users/DartingMelody/gists{/gist_id}","starred_url":"https://api.github.com/users/DartingMelody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartingMelody/subscriptions","organizations_url":"https://api.github.com/users/DartingMelody/orgs","repos_url":"https://api.github.com/users/DartingMelody/repos","events_url":"https://api.github.com/users/DartingMelody/events{/privacy}","received_events_url":"https://api.github.com/users/DartingMelody/received_events","type":"User","site_admin":false},"repo":{"id":123879179,"name":"open-humans-api","full_name":"DartingMelody/open-humans-api","owner":{"login":"DartingMelody","id":25335896,"avatar_url":"https://avatars0.githubusercontent.com/u/25335896?v=4","gravatar_id":"","url":"https://api.github.com/users/DartingMelody","html_url":"https://github.com/DartingMelody","followers_url":"https://api.github.com/users/DartingMelody/followers","following_url":"https://api.github.com/users/DartingMelody/following{/other_user}","gists_url":"https://api.github.com/users/DartingMelody/gists{/gist_id}","starred_url":"https://api.github.com/users/DartingMelody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartingMelody/subscriptions","organizations_url":"https://api.github.com/users/DartingMelody/orgs","repos_url":"https://api.github.com/users/DartingMelody/repos","events_url":"https://api.github.com/users/DartingMelody/events{/privacy}","received_events_url":"https://api.github.com/users/DartingMelody/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DartingMelody/open-humans-api","description":"Tools to work with our APIs.","fork":true,"url":"https://api.github.com/repos/DartingMelody/open-humans-api","forks_url":"https://api.github.com/repos/DartingMelody/open-humans-api/forks","keys_url":"https://api.github.com/repos/DartingMelody/open-humans-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DartingMelody/open-humans-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DartingMelody/open-humans-api/teams","hooks_url":"https://api.github.com/repos/DartingMelody/open-humans-api/hooks","issue_events_url":"https://api.github.com/repos/DartingMelody/open-humans-api/issues/events{/number}","events_url":"https://api.github.com/repos/DartingMelody/open-humans-api/events","assignees_url":"https://api.github.com/repos/DartingMelody/open-humans-api/assignees{/user}","branches_url":"https://api.github.com/repos/DartingMelody/open-humans-api/branches{/branch}","tags_url":"https://api.github.com/repos/DartingMelody/open-humans-api/tags","blobs_url":"https://api.github.com/repos/DartingMelody/open-humans-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DartingMelody/open-humans-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DartingMelody/open-humans-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/DartingMelody/open-humans-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DartingMelody/open-humans-api/statuses/{sha}","languages_url":"https://api.github.com/repos/DartingMelody/open-humans-api/languages","stargazers_url":"https://api.github.com/repos/DartingMelody/open-humans-api/stargazers","contributors_url":"https://api.github.com/repos/DartingMelody/open-humans-api/contributors","subscribers_url":"https://api.github.com/repos/DartingMelody/open-humans-api/subscribers","subscription_url":"https://api.github.com/repos/DartingMelody/open-humans-api/subscription","commits_url":"https://api.github.com/repos/DartingMelody/open-humans-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/DartingMelody/open-humans-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/DartingMelody/open-humans-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/DartingMelody/open-humans-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/DartingMelody/open-humans-api/contents/{+path}","compare_url":"https://api.github.com/repos/DartingMelody/open-humans-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DartingMelody/open-humans-api/merges","archive_url":"https://api.github.com/repos/DartingMelody/open-humans-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DartingMelody/open-humans-api/downloads","issues_url":"https://api.github.com/repos/DartingMelody/open-humans-api/issues{/number}","pulls_url":"https://api.github.com/repos/DartingMelody/open-humans-api/pulls{/number}","milestones_url":"https://api.github.com/repos/DartingMelody/open-humans-api/milestones{/number}","notifications_url":"https://api.github.com/repos/DartingMelody/open-humans-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DartingMelody/open-humans-api/labels{/name}","releases_url":"https://api.github.com/repos/DartingMelody/open-humans-api/releases{/id}","deployments_url":"https://api.github.com/repos/DartingMelody/open-humans-api/deployments","created_at":"2018-03-05T07:08:32Z","updated_at":"2018-03-05T07:08:33Z","pushed_at":"2018-03-11T16:42:08Z","git_url":"git://github.com/DartingMelody/open-humans-api.git","ssh_url":"git@github.com:DartingMelody/open-humans-api.git","clone_url":"https://github.com/DartingMelody/open-humans-api.git","svn_url":"https://github.com/DartingMelody/open-humans-api","homepage":null,"size":87,"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":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenHumans:master","ref":"master","sha":"720db46c3acba9fc7b3eaa827411fa2b00b3e071","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-11T13:13:31Z","pushed_at":"2018-03-11T16:42:09Z","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":58,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":11,"open_issues":10,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36"},"html":{"href":"https://github.com/OpenHumans/open-humans-api/pull/36"},"issue":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/36"},"comments":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/pulls/36/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/36/commits"},"statuses":{"href":"https://api.github.com/repos/OpenHumans/open-humans-api/statuses/f2c516a66ca0120ac6e5e12d9af3a5562f6c1feb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}