{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/comments/33671551","id":33671551,"diff_hunk":"@@ -656,6 +575,69 @@ def setUp(self):\n         self.bi_cache = self.store.batch_info_cache\n         self.msg_helper = self.add_helper(MessageHelper())\n \n+    @inlineCallbacks\n+    def _create_inbound_message_sequence(self, timestamps=False,\n+                                         addresses=False, reverse=False):\n+        \"\"\"\n+        Create a sequence of 5 inbound messages in a new batch and add them to\n+        the backend. Returns the batch id and the list of message keys.\n+        \"\"\"\n+        batch_id = yield self.backend.batch_start()\n+        all_keys = []\n+        start = (datetime.utcnow().replace(microsecond=0) -\n+                 timedelta(seconds=10))\n+        for i in xrange(5):\n+            timestamp = start + timedelta(seconds=i)\n+            addr = \"addr%s\" % (i,)\n+            msg = self.msg_helper.make_inbound(\n+                \"Message %s\" % (i,), timestamp=timestamp, from_addr=addr)\n+            yield self.backend.add_inbound_message(msg, batch_ids=[batch_id])\n+\n+            key_tuple = [msg[\"message_id\"], ]\n+            if timestamps:\n+                key_tuple.append(format_vumi_date(timestamp))\n+            if addresses:\n+                key_tuple.append(addr)\n+            all_keys.append(\n+                tuple(key_tuple) if len(key_tuple) > 1 else key_tuple[0])","path":"vumi_message_store/tests/test_message_store.py","position":178,"original_position":178,"commit_id":"86f448cb1f2813aa7ab7a24dc807a794acd968b6","original_commit_id":"86f448cb1f2813aa7ab7a24dc807a794acd968b6","user":{"login":"jerith","id":43731,"avatar_url":"https://avatars.githubusercontent.com/u/43731?v=3","gravatar_id":"","url":"https://api.github.com/users/jerith","html_url":"https://github.com/jerith","followers_url":"https://api.github.com/users/jerith/followers","following_url":"https://api.github.com/users/jerith/following{/other_user}","gists_url":"https://api.github.com/users/jerith/gists{/gist_id}","starred_url":"https://api.github.com/users/jerith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerith/subscriptions","organizations_url":"https://api.github.com/users/jerith/orgs","repos_url":"https://api.github.com/users/jerith/repos","events_url":"https://api.github.com/users/jerith/events{/privacy}","received_events_url":"https://api.github.com/users/jerith/received_events","type":"User","site_admin":false},"body":"All these conditionals add complexity to this helper, which can make it harder to understand exactly what the tests using it are doing. Maybe it would be better to return the message objects (or the complete tuples) and have the tests extract the bits they want and reverse if necessary?","created_at":"2015-07-01T12:02:47Z","updated_at":"2015-07-01T12:02:47Z","html_url":"https://github.com/praekelt/vumi-message-store/pull/12#discussion_r33671551","pull_request_url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/comments/33671551"},"html":{"href":"https://github.com/praekelt/vumi-message-store/pull/12#discussion_r33671551"},"pull_request":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12","id":38865649,"html_url":"https://github.com/praekelt/vumi-message-store/pull/12","diff_url":"https://github.com/praekelt/vumi-message-store/pull/12.diff","patch_url":"https://github.com/praekelt/vumi-message-store/pull/12.patch","issue_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues/12","number":12,"state":"open","locked":false,"title":"Update model schemas","user":{"login":"JayH5","id":1748643,"avatar_url":"https://avatars.githubusercontent.com/u/1748643?v=3","gravatar_id":"","url":"https://api.github.com/users/JayH5","html_url":"https://github.com/JayH5","followers_url":"https://api.github.com/users/JayH5/followers","following_url":"https://api.github.com/users/JayH5/following{/other_user}","gists_url":"https://api.github.com/users/JayH5/gists{/gist_id}","starred_url":"https://api.github.com/users/JayH5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JayH5/subscriptions","organizations_url":"https://api.github.com/users/JayH5/orgs","repos_url":"https://api.github.com/users/JayH5/repos","events_url":"https://api.github.com/users/JayH5/events{/privacy}","received_events_url":"https://api.github.com/users/JayH5/received_events","type":"User","site_admin":false},"body":"`InboundMessage` is version 3 should be 5\r\n`OutboundMessage` is version 3 should be 5\r\n`Event` is version 1 should be 2\r\n\r\nNeed to:\r\n* Add migrations (from Vumi)\r\n* Add tests (from Vumi)\r\n* Add methods to access reverse timestamp indexes introduced in schema v5 (but not adding to message store interface yet).","created_at":"2015-06-30T10:58:39Z","updated_at":"2015-07-01T12:02:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"69d98902187803ed36182eb283160122acc3a736","assignee":{"login":"JayH5","id":1748643,"avatar_url":"https://avatars.githubusercontent.com/u/1748643?v=3","gravatar_id":"","url":"https://api.github.com/users/JayH5","html_url":"https://github.com/JayH5","followers_url":"https://api.github.com/users/JayH5/followers","following_url":"https://api.github.com/users/JayH5/following{/other_user}","gists_url":"https://api.github.com/users/JayH5/gists{/gist_id}","starred_url":"https://api.github.com/users/JayH5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JayH5/subscriptions","organizations_url":"https://api.github.com/users/JayH5/orgs","repos_url":"https://api.github.com/users/JayH5/repos","events_url":"https://api.github.com/users/JayH5/events{/privacy}","received_events_url":"https://api.github.com/users/JayH5/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12/commits","review_comments_url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12/comments","review_comment_url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues/12/comments","statuses_url":"https://api.github.com/repos/praekelt/vumi-message-store/statuses/86f448cb1f2813aa7ab7a24dc807a794acd968b6","head":{"label":"praekelt:feature/issue-12-update-model-schemas","ref":"feature/issue-12-update-model-schemas","sha":"86f448cb1f2813aa7ab7a24dc807a794acd968b6","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":30292357,"name":"vumi-message-store","full_name":"praekelt/vumi-message-store","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/vumi-message-store","description":"A persistent store for vumi messages.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi-message-store","forks_url":"https://api.github.com/repos/praekelt/vumi-message-store/forks","keys_url":"https://api.github.com/repos/praekelt/vumi-message-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi-message-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi-message-store/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi-message-store/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi-message-store/events","assignees_url":"https://api.github.com/repos/praekelt/vumi-message-store/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi-message-store/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi-message-store/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi-message-store/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi-message-store/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi-message-store/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi-message-store/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi-message-store/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi-message-store/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi-message-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi-message-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi-message-store/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi-message-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi-message-store/merges","archive_url":"https://api.github.com/repos/praekelt/vumi-message-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi-message-store/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi-message-store/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi-message-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi-message-store/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi-message-store/releases{/id}","created_at":"2015-02-04T09:56:40Z","updated_at":"2015-04-01T08:29:10Z","pushed_at":"2015-07-01T11:09:15Z","git_url":"git://github.com/praekelt/vumi-message-store.git","ssh_url":"git@github.com:praekelt/vumi-message-store.git","clone_url":"https://github.com/praekelt/vumi-message-store.git","svn_url":"https://github.com/praekelt/vumi-message-store","homepage":null,"size":288,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"9d9663a6e663e54e759499d3041b5911cae804eb","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":30292357,"name":"vumi-message-store","full_name":"praekelt/vumi-message-store","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/vumi-message-store","description":"A persistent store for vumi messages.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi-message-store","forks_url":"https://api.github.com/repos/praekelt/vumi-message-store/forks","keys_url":"https://api.github.com/repos/praekelt/vumi-message-store/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi-message-store/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi-message-store/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi-message-store/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi-message-store/events","assignees_url":"https://api.github.com/repos/praekelt/vumi-message-store/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi-message-store/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi-message-store/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi-message-store/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi-message-store/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi-message-store/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi-message-store/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi-message-store/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi-message-store/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi-message-store/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi-message-store/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi-message-store/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi-message-store/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi-message-store/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi-message-store/merges","archive_url":"https://api.github.com/repos/praekelt/vumi-message-store/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi-message-store/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi-message-store/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi-message-store/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi-message-store/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi-message-store/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi-message-store/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi-message-store/releases{/id}","created_at":"2015-02-04T09:56:40Z","updated_at":"2015-04-01T08:29:10Z","pushed_at":"2015-07-01T11:09:15Z","git_url":"git://github.com/praekelt/vumi-message-store.git","ssh_url":"git@github.com:praekelt/vumi-message-store.git","clone_url":"https://github.com/praekelt/vumi-message-store.git","svn_url":"https://github.com/praekelt/vumi-message-store","homepage":null,"size":288,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12"},"html":{"href":"https://github.com/praekelt/vumi-message-store/pull/12"},"issue":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/issues/12"},"comments":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/vumi-message-store/statuses/86f448cb1f2813aa7ab7a24dc807a794acd968b6"}}}}