{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/170374283","pull_request_review_id":99060242,"id":170374283,"diff_hunk":"@@ -0,0 +1,79 @@\n+from __future__ import absolute_import\n+\n+import os\n+from datetime import datetime\n+\n+from django.test import SimpleTestCase\n+\n+from dimagi.utils.parsing import string_to_utc_datetime\n+from corehq.apps.app_manager.tests.util import TestXmlMixin\n+from corehq.form_processor.interfaces.processor import FormProcessorInterface\n+from corehq.form_processor.utils import convert_xform_to_json\n+from phonelog.utils import SumoLogicLog\n+\n+\n+class TestSumologic(SimpleTestCase, TestXmlMixin):\n+    root = os.path.dirname(__file__)\n+    file_path = ('data',)\n+\n+    def setUp(self):\n+        self.domain = 'test_domain'\n+        self.received_on = datetime.utcnow()\n+\n+    def _get_xform(self, filename):\n+        xform = FormProcessorInterface(self.domain).new_xform(convert_xform_to_json(self.get_xml(filename)))\n+        xform.received_on = self.received_on\n+        return xform\n+\n+    def test_log_error(self):\n+        xform = self._get_xform('log_subreport')\n+        compiled_log = SumoLogicLog(self.domain, xform).log_subreport()\n+        expected_log = (\n+            \"[log_date=2018-02-13T15:19:30.622-05] [log_submission_date={received}] [log_type=maintenance] \"\n+            \"[domain={domain}] [username=t1] [device_id=014915000230428] [app_version=260] \"\n+            \"[cc_version=2.43] [msg=Succesfully submitted 1 device reports to server.]\"\n+        ).format(domain=self.domain, received=self.received_on)\n+\n+        self.assertEqual(expected_log, compiled_log)\n+\n+    def test_usererror(self):\n+        xform = self._get_xform('usererror_subreport')\n+        compiled_log = SumoLogicLog(self.domain, xform).user_error_subreport()\n+        expected_log = (\n+            \"[log_date=2018-02-22T17:21:21.201-05] [log_submission_date={received}] [log_type=error-config] \"\n+            \"[domain={domain}] [username=t1] [device_id=014915000230428] [app_version=260] \"\n+            \"[cc_version=2.43] [msg=This is a test user error] [app_id=73d5f08b9d55fe48602906a89672c214] \"\n+            \"[user_id=37cc2dcdb1abf5c16bab0763f435e6b7] [session=session] [expr=an expression]\"\n+        ).format(domain=self.domain, received=self.received_on)\n+\n+        self.assertEqual(expected_log, compiled_log)\n+\n+    def test_forceclose(self):\n+        xform = self._get_xform('forceclose_subreport')\n+        compiled_log = SumoLogicLog(self.domain, xform).force_close_subreport()\n+        expected_log = (\n+            \"[log_date=2018-02-22T17:21:21.232-05] [log_submission_date={received}] [log_type=forceclose] \"\n+            \"[domain={domain}] [username=t1] [device_id=014915000230428] [app_version=260] \"\n+            \"[cc_version=2.43] \"\n+            \"\"\"[msg=java.lang.RuntimeException: Unable to start activity ComponentInfo{{org.commcare.dalvik.debug/org.commcare.activities.MenuActivity}}: java.lang.RuntimeException\n+\t    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)\n+\t    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)","path":"corehq/ex-submodules/phonelog/tests/test_sumologic.py","position":60,"original_position":60,"commit_id":"f2898d7a1cc5275110e7a0e7622a940eb053be23","original_commit_id":"f2898d7a1cc5275110e7a0e7622a940eb053be23","user":{"login":"stickler-ci","id":16011037,"avatar_url":"https://avatars3.githubusercontent.com/u/16011037?v=4","gravatar_id":"","url":"https://api.github.com/users/stickler-ci","html_url":"https://github.com/stickler-ci","followers_url":"https://api.github.com/users/stickler-ci/followers","following_url":"https://api.github.com/users/stickler-ci/following{/other_user}","gists_url":"https://api.github.com/users/stickler-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/stickler-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stickler-ci/subscriptions","organizations_url":"https://api.github.com/users/stickler-ci/orgs","repos_url":"https://api.github.com/users/stickler-ci/repos","events_url":"https://api.github.com/users/stickler-ci/events{/privacy}","received_events_url":"https://api.github.com/users/stickler-ci/received_events","type":"User","site_admin":false},"body":"W191 indentation contains tabs\nE101 indentation contains mixed spaces and tabs","created_at":"2018-02-23T21:37:15Z","updated_at":"2018-02-23T21:37:17Z","html_url":"https://github.com/dimagi/commcare-hq/pull/19597#discussion_r170374283","pull_request_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/170374283"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/19597#discussion_r170374283"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597","id":171122069,"html_url":"https://github.com/dimagi/commcare-hq/pull/19597","diff_url":"https://github.com/dimagi/commcare-hq/pull/19597.diff","patch_url":"https://github.com/dimagi/commcare-hq/pull/19597.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/19597","number":19597,"state":"open","locked":false,"title":"Add Sumologic Logs","user":{"login":"proteusvacuum","id":146896,"avatar_url":"https://avatars1.githubusercontent.com/u/146896?v=4","gravatar_id":"","url":"https://api.github.com/users/proteusvacuum","html_url":"https://github.com/proteusvacuum","followers_url":"https://api.github.com/users/proteusvacuum/followers","following_url":"https://api.github.com/users/proteusvacuum/following{/other_user}","gists_url":"https://api.github.com/users/proteusvacuum/gists{/gist_id}","starred_url":"https://api.github.com/users/proteusvacuum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/proteusvacuum/subscriptions","organizations_url":"https://api.github.com/users/proteusvacuum/orgs","repos_url":"https://api.github.com/users/proteusvacuum/repos","events_url":"https://api.github.com/users/proteusvacuum/events{/privacy}","received_events_url":"https://api.github.com/users/proteusvacuum/received_events","type":"User","site_admin":false},"body":"https://docs.google.com/document/d/18sSwv2GRGepOIHthC6lxQAh_aUYgDcTou6w9jL2976o/edit#\r\n\r\n@snopoke \r\n@biyeun \r\nDepends on: https://github.com/dimagi/commcare-cloud/pull/1398","created_at":"2018-02-23T21:36:41Z","updated_at":"2018-02-23T21:37:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d352d23a009ee8a45efd1a4d376e585440d29fc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":724787015,"url":"https://api.github.com/repos/dimagi/commcare-hq/labels/product/invisible","name":"product/invisible","color":"cfd2d6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/19597/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/f2898d7a1cc5275110e7a0e7622a940eb053be23","head":{"label":"dimagi:fr/sumologic-logs","ref":"fr/sumologic-logs","sha":"f2898d7a1cc5275110e7a0e7622a940eb053be23","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2018-02-13T23:45:19Z","pushed_at":"2018-02-23T21:36:42Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"https://www.commcarehq.org","size":464554,"stargazers_count":86,"watchers_count":86,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":102,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":102,"open_issues":92,"watchers":86,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"459b34d16a823f6d2d39e7a1d44d1c913fa520e0","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2018-02-13T23:45:19Z","pushed_at":"2018-02-23T21:36:42Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"https://www.commcarehq.org","size":464554,"stargazers_count":86,"watchers_count":86,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":102,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":102,"open_issues":92,"watchers":86,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/19597"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/19597"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/19597/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/19597/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-hq/statuses/f2898d7a1cc5275110e7a0e7622a940eb053be23"}},"author_association":"OWNER"}}
{"actor":{"display_login":"stickler-ci"}}