{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/comments/168720596","pull_request_review_id":97133718,"id":168720596,"diff_hunk":"@@ -0,0 +1,100 @@\n+import os\n+import boto3\n+import io\n+import json\n+import uuid\n+from moto import mock_sqs\n+from unittest import TestCase\n+from unittest.mock import patch\n+\n+from src import event_handler\n+\n+\n+@mock_sqs\n+class EventHandlerTest(TestCase):\n+\n+    def setUp(self):\n+        setup_stub_aws_config()\n+        self.__sqs_client = boto3.client('sqs')\n+        self.__queue_url = create_queue(self.__sqs_client)\n+        add_queue_url_to_environment_variables(self.__queue_url)\n+\n+    @patch('sys.stdout', new_callable=io.StringIO)\n+    def test_reads_messages_from_queue(self, mock_stdout):\n+        self.__send_messages_to_queue(\n+            [\n+                create_event_string('sample-id-1'),\n+                create_event_string('sample-id-2'),\n+            ]\n+        )\n+\n+        event_handler.store_queued_events(None, None)\n+\n+        self.assertEqual(mock_stdout.getvalue(), 'sample-id-1\\nsample-id-2\\n')\n+        self.assertEqual(self.__number_of_visible_messages(), '0')\n+        self.assertEqual(self.__number_of_hidden_messages(), '0')\n+\n+    @patch('sys.stdout', new_callable=io.StringIO)\n+    def test_does_not_delete_invalid_messages(self, mock_stdout):\n+        self.__send_messages_to_queue(","path":"test/event_handler_test.py","position":39,"original_position":39,"commit_id":"b1def8230841048567749d8f08a150567c90f70d","original_commit_id":"b1def8230841048567749d8f08a150567c90f70d","user":{"login":"kornysietsma","id":17765,"avatar_url":"https://avatars3.githubusercontent.com/u/17765?v=4","gravatar_id":"","url":"https://api.github.com/users/kornysietsma","html_url":"https://github.com/kornysietsma","followers_url":"https://api.github.com/users/kornysietsma/followers","following_url":"https://api.github.com/users/kornysietsma/following{/other_user}","gists_url":"https://api.github.com/users/kornysietsma/gists{/gist_id}","starred_url":"https://api.github.com/users/kornysietsma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kornysietsma/subscriptions","organizations_url":"https://api.github.com/users/kornysietsma/orgs","repos_url":"https://api.github.com/users/kornysietsma/repos","events_url":"https://api.github.com/users/kornysietsma/events{/privacy}","received_events_url":"https://api.github.com/users/kornysietsma/received_events","type":"User","site_admin":false},"body":"Something to discuss - should we be moving messages to a dead letter queue?  Does SQS do this somehow automatically?  (not a blocker for this PR!)","created_at":"2018-02-16T10:28:37Z","updated_at":"2018-02-16T10:29:16Z","html_url":"https://github.com/alphagov/verify-event-recorder-service/pull/1#discussion_r168720596","pull_request_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/comments/168720596"},"html":{"href":"https://github.com/alphagov/verify-event-recorder-service/pull/1#discussion_r168720596"},"pull_request":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1","id":169380522,"html_url":"https://github.com/alphagov/verify-event-recorder-service/pull/1","diff_url":"https://github.com/alphagov/verify-event-recorder-service/pull/1.diff","patch_url":"https://github.com/alphagov/verify-event-recorder-service/pull/1.patch","issue_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/1","number":1,"state":"open","locked":false,"title":"ABD-41: Extend setup to also create a virtualenv.","user":{"login":"MichaelWalker","id":8644502,"avatar_url":"https://avatars0.githubusercontent.com/u/8644502?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelWalker","html_url":"https://github.com/MichaelWalker","followers_url":"https://api.github.com/users/MichaelWalker/followers","following_url":"https://api.github.com/users/MichaelWalker/following{/other_user}","gists_url":"https://api.github.com/users/MichaelWalker/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelWalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelWalker/subscriptions","organizations_url":"https://api.github.com/users/MichaelWalker/orgs","repos_url":"https://api.github.com/users/MichaelWalker/repos","events_url":"https://api.github.com/users/MichaelWalker/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelWalker/received_events","type":"User","site_admin":false},"body":"Using virtualenv allows us to\r\na) have a nice, well isolated python environment in which to develop.\r\nb) package all of our dependencies in a format that we can ship to AWS.\r\n\r\nSolo: @michaelwalker","created_at":"2018-02-15T14:07:36Z","updated_at":"2018-02-16T10:29:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b69c12077612a0a5a41f1843d7737c45a0cbbbb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1/commits","review_comments_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1/comments","review_comment_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/1/comments","statuses_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/statuses/b1def8230841048567749d8f08a150567c90f70d","head":{"label":"alphagov:ABD-41","ref":"ABD-41","sha":"b1def8230841048567749d8f08a150567c90f70d","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":121251624,"name":"verify-event-recorder-service","full_name":"alphagov/verify-event-recorder-service","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/verify-event-recorder-service","description":"This service is part of Verify's event recording system; its purpose is to read events from a queue and write them to a permanent datastore.","fork":false,"url":"https://api.github.com/repos/alphagov/verify-event-recorder-service","forks_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/forks","keys_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/teams","hooks_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/hooks","issue_events_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/events","assignees_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/tags","blobs_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/languages","stargazers_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/stargazers","contributors_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/contributors","subscribers_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/subscribers","subscription_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/subscription","commits_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/merges","archive_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/downloads","issues_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/deployments","created_at":"2018-02-12T13:44:57Z","updated_at":"2018-02-13T11:01:52Z","pushed_at":"2018-02-16T08:40:00Z","git_url":"git://github.com/alphagov/verify-event-recorder-service.git","ssh_url":"git@github.com:alphagov/verify-event-recorder-service.git","clone_url":"https://github.com/alphagov/verify-event-recorder-service.git","svn_url":"https://github.com/alphagov/verify-event-recorder-service","homepage":null,"size":22,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"66b242dc304828d7a28774e9fa9e7726971ef11e","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":121251624,"name":"verify-event-recorder-service","full_name":"alphagov/verify-event-recorder-service","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/verify-event-recorder-service","description":"This service is part of Verify's event recording system; its purpose is to read events from a queue and write them to a permanent datastore.","fork":false,"url":"https://api.github.com/repos/alphagov/verify-event-recorder-service","forks_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/forks","keys_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/teams","hooks_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/hooks","issue_events_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/events","assignees_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/tags","blobs_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/languages","stargazers_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/stargazers","contributors_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/contributors","subscribers_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/subscribers","subscription_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/subscription","commits_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/merges","archive_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/downloads","issues_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/verify-event-recorder-service/deployments","created_at":"2018-02-12T13:44:57Z","updated_at":"2018-02-13T11:01:52Z","pushed_at":"2018-02-16T08:40:00Z","git_url":"git://github.com/alphagov/verify-event-recorder-service.git","ssh_url":"git@github.com:alphagov/verify-event-recorder-service.git","clone_url":"https://github.com/alphagov/verify-event-recorder-service.git","svn_url":"https://github.com/alphagov/verify-event-recorder-service","homepage":null,"size":22,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1"},"html":{"href":"https://github.com/alphagov/verify-event-recorder-service/pull/1"},"issue":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/1"},"comments":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/verify-event-recorder-service/statuses/b1def8230841048567749d8f08a150567c90f70d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"kornysietsma"}}