{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/comments/32210426","id":32210426,"diff_hunk":"@@ -0,0 +1,61 @@\n+# coding=utf-8\n+\n+import unittest\n+\n+from dmutils.presenters import Presenters\n+presenters = Presenters()\n+\n+\n+class TestPresenters(unittest.TestCase):\n+    def test_service_id(self):\n+        G5 = presenters.present(\n+            \"5.G5.12345\",\n+            {\"type\": \"service_id\"}\n+        )\n+        G6 = presenters.present(\n+            \"1234567891023456\",\n+            {\"type\": \"service_id\"}\n+        )\n+        self.assertEquals(\n+            G5,\n+            [\"5.G5.12345\"]\n+        )\n+        self.assertEquals(\n+            G6,\n+            [\"1234\", \"5678\", \"9102\", \"3456\"]\n+        )\n+\n+    def test_upload(self):\n+        file = presenters.present(\n+            \"http://example.com/path/to/file.pdf\",\n+            {\"type\": \"upload\"}\n+        )\n+        self.assertEquals(\n+            file,\n+            {\n+                \"url\": \"http://example.com/path/to/file.pdf\",\n+                \"filename\": \"file.pdf\"\n+            }\n+        )\n+\n+    def test_boolean(self):\n+        yes = presenters.present(\n+            True,\n+            {\"type\": \"boolean\"}\n+        )\n+        no = presenters.present(\n+            False,\n+            {\"type\": \"boolean\"}\n+        )\n+        nothing = presenters.present(\n+            None,\n+            {\"type\": \"boolean\"}\n+        )\n+        empty = presenters.present(\n+            \"\",\n+            {\"type\": \"boolean\"}\n+        )\n+        self.assertEquals(yes, \"Yes\")","path":"tests/test_presenters.py","position":null,"original_position":58,"commit_id":"986b2e8897b48991cb234ab5a3ea262917a1e4ff","original_commit_id":"0ceffd26446444eab1b794b2fcb8bbf2d61a8851","user":{"login":"quis","id":355079,"avatar_url":"https://avatars.githubusercontent.com/u/355079?v=3","gravatar_id":"","url":"https://api.github.com/users/quis","html_url":"https://github.com/quis","followers_url":"https://api.github.com/users/quis/followers","following_url":"https://api.github.com/users/quis/following{/other_user}","gists_url":"https://api.github.com/users/quis/gists{/gist_id}","starred_url":"https://api.github.com/users/quis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quis/subscriptions","organizations_url":"https://api.github.com/users/quis/orgs","repos_url":"https://api.github.com/users/quis/repos","events_url":"https://api.github.com/users/quis/events{/privacy}","received_events_url":"https://api.github.com/users/quis/received_events","type":"User","site_admin":false},"body":"Good point, addressed in 986b2e8897b48991cb234ab5a3ea262917a1e4ff","created_at":"2015-06-11T11:09:24Z","updated_at":"2015-06-11T11:09:24Z","html_url":"https://github.com/alphagov/digitalmarketplace-utils/pull/57#discussion_r32210426","pull_request_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/comments/32210426"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-utils/pull/57#discussion_r32210426"},"pull_request":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57","id":37449875,"html_url":"https://github.com/alphagov/digitalmarketplace-utils/pull/57","diff_url":"https://github.com/alphagov/digitalmarketplace-utils/pull/57.diff","patch_url":"https://github.com/alphagov/digitalmarketplace-utils/pull/57.patch","issue_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/57","number":57,"state":"open","locked":false,"title":"Add presenter for boolean values","user":{"login":"quis","id":355079,"avatar_url":"https://avatars.githubusercontent.com/u/355079?v=3","gravatar_id":"","url":"https://api.github.com/users/quis","html_url":"https://github.com/quis","followers_url":"https://api.github.com/users/quis/followers","following_url":"https://api.github.com/users/quis/following{/other_user}","gists_url":"https://api.github.com/users/quis/gists{/gist_id}","starred_url":"https://api.github.com/users/quis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quis/subscriptions","organizations_url":"https://api.github.com/users/quis/orgs","repos_url":"https://api.github.com/users/quis/repos","events_url":"https://api.github.com/users/quis/events{/privacy}","received_events_url":"https://api.github.com/users/quis/received_events","type":"User","site_admin":false},"body":"\"Yes\" and \"No\" is friendlier than \"True\" and \"False\"\r\n\r\nTests are better than no tests.","created_at":"2015-06-11T10:36:19Z","updated_at":"2015-06-11T11:09:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c3fe32919db0a1532ef6cae1677d5972cd3a26e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57/commits","review_comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57/comments","review_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/57/comments","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/statuses/986b2e8897b48991cb234ab5a3ea262917a1e4ff","head":{"label":"alphagov:add-presenter-for-boolean-values","ref":"add-presenter-for-boolean-values","sha":"986b2e8897b48991cb234ab5a3ea262917a1e4ff","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","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":34396268,"name":"digitalmarketplace-utils","full_name":"alphagov/digitalmarketplace-utils","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","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/digitalmarketplace-utils","description":"Common utils for Digital Marketplace apps.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/releases{/id}","created_at":"2015-04-22T14:47:45Z","updated_at":"2015-05-08T12:25:25Z","pushed_at":"2015-06-11T11:08:35Z","git_url":"git://github.com/alphagov/digitalmarketplace-utils.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-utils.git","clone_url":"https://github.com/alphagov/digitalmarketplace-utils.git","svn_url":"https://github.com/alphagov/digitalmarketplace-utils","homepage":null,"size":725,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"da52be2c1e8a07ca2576db58294a069f1c23c2d2","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","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":34396268,"name":"digitalmarketplace-utils","full_name":"alphagov/digitalmarketplace-utils","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","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/digitalmarketplace-utils","description":"Common utils for Digital Marketplace apps.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/releases{/id}","created_at":"2015-04-22T14:47:45Z","updated_at":"2015-05-08T12:25:25Z","pushed_at":"2015-06-11T11:08:35Z","git_url":"git://github.com/alphagov/digitalmarketplace-utils.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-utils.git","clone_url":"https://github.com/alphagov/digitalmarketplace-utils.git","svn_url":"https://github.com/alphagov/digitalmarketplace-utils","homepage":null,"size":725,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-utils/pull/57"},"issue":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/57"},"comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-utils/statuses/986b2e8897b48991cb234ab5a3ea262917a1e4ff"}}}}