{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/vumi/pulls/comments/29867546","id":29867546,"diff_hunk":"@@ -3,15 +3,117 @@\n \"\"\"Tests for vumi.persist.fields.\"\"\"\n \n from datetime import datetime\n+from functools import wraps\n \n-from vumi.message import Message\n+from twisted.internet.defer import inlineCallbacks, returnValue\n \n+from vumi.message import Message, TransportUserMessage\n from vumi.persist.fields import (\n     ValidationError, Field, Integer, Unicode, Tag, Timestamp, Json,\n-    ListOf, SetOf, Dynamic, FieldWithSubtype, Boolean, VumiMessage)\n-from vumi.tests.helpers import VumiTestCase\n+    ListOf, SetOf, Dynamic, FieldWithSubtype, Boolean, VumiMessage,\n+    ForeignKey, ManyToMany)\n+from vumi.persist.model import Manager, Model\n+from vumi.tests.helpers import VumiTestCase, MessageHelper, import_skip\n \n \n+def needs_riak(method):\n+    \"\"\"\n+    Mark a test method as needing Riak setup.\n+    \"\"\"\n+    method.needs_riak = True\n+    return method\n+\n+\n+class ModelFieldTestsDecorator(object):\n+    \"\"\"\n+    Class decorator for replacing `@needs_riak`-marked test methods with two\n+    wrapped versions, one for each Riak manager.\n+\n+    This is used here instead of the more usual mechanism of a mixin and two\n+    subclasses because we have a lot of small test classes which have several\n+    test methods that don't need Riak.","path":"vumi/persist/tests/test_fields.py","position":35,"original_position":35,"commit_id":"cb6e7cfbfb9466e398ca91e05e392519fc11e530","original_commit_id":"cb6e7cfbfb9466e398ca91e05e392519fc11e530","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":"Yes. I started with the usual mixin-and-subclasses pattern and ended up drowning in boilerplate.","created_at":"2015-05-07T16:10:42Z","updated_at":"2015-05-07T16:10:42Z","html_url":"https://github.com/praekelt/vumi/pull/939#discussion_r29867546","pull_request_url":"https://api.github.com/repos/praekelt/vumi/pulls/939","_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/comments/29867546"},"html":{"href":"https://github.com/praekelt/vumi/pull/939#discussion_r29867546"},"pull_request":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/939"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/vumi/pulls/939","id":33164750,"html_url":"https://github.com/praekelt/vumi/pull/939","diff_url":"https://github.com/praekelt/vumi/pull/939.diff","patch_url":"https://github.com/praekelt/vumi/pull/939.patch","issue_url":"https://api.github.com/repos/praekelt/vumi/issues/939","number":939,"state":"open","locked":false,"title":"Split field and model tests better","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":"We currently have minimal field-specific tests in `vumi.persist.tests.test_fields` and a random assortment of model and field-specific tests in `vumi.persist.tests.test_model`. We should move all field-specific tests from the latter to the former.","created_at":"2015-04-13T13:47:07Z","updated_at":"2015-05-07T16:10:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e015091cdc396c8467e7f37564dca52267ad920","assignee":{"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},"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/vumi/pulls/939/commits","review_comments_url":"https://api.github.com/repos/praekelt/vumi/pulls/939/comments","review_comment_url":"https://api.github.com/repos/praekelt/vumi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/vumi/issues/939/comments","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/cb6e7cfbfb9466e398ca91e05e392519fc11e530","head":{"label":"praekelt:feature/issue-939-split-field-and-model-tests","ref":"feature/issue-939-split-field-and-model-tests","sha":"cb6e7cfbfb9466e398ca91e05e392519fc11e530","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":1081665,"name":"vumi","full_name":"praekelt/vumi","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","description":"Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi","forks_url":"https://api.github.com/repos/praekelt/vumi/forks","keys_url":"https://api.github.com/repos/praekelt/vumi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi/events","assignees_url":"https://api.github.com/repos/praekelt/vumi/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi/merges","archive_url":"https://api.github.com/repos/praekelt/vumi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi/releases{/id}","created_at":"2010-11-15T11:34:03Z","updated_at":"2015-05-06T12:17:32Z","pushed_at":"2015-04-30T12:09:33Z","git_url":"git://github.com/praekelt/vumi.git","ssh_url":"git@github.com:praekelt/vumi.git","clone_url":"https://github.com/praekelt/vumi.git","svn_url":"https://github.com/praekelt/vumi","homepage":"","size":22425,"stargazers_count":211,"watchers_count":211,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":88,"forks":74,"open_issues":88,"watchers":211,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"d390cf927042e129ef227b9efc7a22414cacb627","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":1081665,"name":"vumi","full_name":"praekelt/vumi","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","description":"Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi","forks_url":"https://api.github.com/repos/praekelt/vumi/forks","keys_url":"https://api.github.com/repos/praekelt/vumi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi/events","assignees_url":"https://api.github.com/repos/praekelt/vumi/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi/merges","archive_url":"https://api.github.com/repos/praekelt/vumi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi/releases{/id}","created_at":"2010-11-15T11:34:03Z","updated_at":"2015-05-06T12:17:32Z","pushed_at":"2015-04-30T12:09:33Z","git_url":"git://github.com/praekelt/vumi.git","ssh_url":"git@github.com:praekelt/vumi.git","clone_url":"https://github.com/praekelt/vumi.git","svn_url":"https://github.com/praekelt/vumi","homepage":"","size":22425,"stargazers_count":211,"watchers_count":211,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":88,"forks":74,"open_issues":88,"watchers":211,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/939"},"html":{"href":"https://github.com/praekelt/vumi/pull/939"},"issue":{"href":"https://api.github.com/repos/praekelt/vumi/issues/939"},"comments":{"href":"https://api.github.com/repos/praekelt/vumi/issues/939/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/939/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/939/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/vumi/statuses/cb6e7cfbfb9466e398ca91e05e392519fc11e530"}}}}