{"action":"created","comment":{"url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments/32647961","id":32647961,"diff_hunk":"@@ -1,6 +1,93 @@\n (ns electorate-works.handlers-test\n-    (:require [electorate-works.handlers :refer :all]\n-              [clojure.test :refer :all]))\n+  (:require [electorate-works.handlers :refer :all]\n+            [electorate-works.entities.electorate :as e]\n+            [turbovote.resource-config :refer [config]]\n+            [clojure.test :refer :all]\n+            [datomic.api :as d]\n+            [datomic-toolbox :as db])\n+  (:import [java.util.regex Pattern]))\n \n (deftest ok-test\n   (is (= :ok (:status (ok {})))))\n+\n+(use-fixtures :each\n+  (fn [f]\n+     (d/delete-database (config :datomic :uri))\n+     (db/initialize)\n+     (f)))\n+\n+(deftest create-electorate-test\n+  (testing \"validates input\"\n+    (let [user-id (java.util.UUID/randomUUID)\n+          election-id (java.util.UUID/randomUUID)\n+          reg-authority-id (java.util.UUID/randomUUID)\n+          elec-authority-id (java.util.UUID/randomUUID)\n+          handler (handle-errors create-electorate)\n+          good-message {:user-id user-id\n+                        :election-id election-id\n+                        :election-authority-ids #{reg-authority-id\n+                                                  elec-authority-id}}]\n+      (testing \"requires a user-id\"\n+        (let [response (handler (dissoc good-message :user-id))]\n+          (is (= :error (:status response)))\n+          (is (re-find (Pattern/compile (Pattern/quote \"{:user-id missing-required-key}\"))","path":"test/electorate_works/handlers_test.clj","position":35,"original_position":35,"commit_id":"96aa3a7499fdfd98868f5a889132060c8793f570","original_commit_id":"96aa3a7499fdfd98868f5a889132060c8793f570","user":{"login":"tank157","id":4147,"avatar_url":"https://avatars.githubusercontent.com/u/4147?v=3","gravatar_id":"","url":"https://api.github.com/users/tank157","html_url":"https://github.com/tank157","followers_url":"https://api.github.com/users/tank157/followers","following_url":"https://api.github.com/users/tank157/following{/other_user}","gists_url":"https://api.github.com/users/tank157/gists{/gist_id}","starred_url":"https://api.github.com/users/tank157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tank157/subscriptions","organizations_url":"https://api.github.com/users/tank157/orgs","repos_url":"https://api.github.com/users/tank157/repos","events_url":"https://api.github.com/users/tank157/events{/privacy}","received_events_url":"https://api.github.com/users/tank157/received_events","type":"User","site_admin":false},"body":"This was me cargo culting myself. In some of the previous validations I've done, I've included a lot more of the schema messages, which gets into a lot of `[]` and `()` and `{}` that become difficult to properly escape, so the Pattern/quote just gives a convenient way to tell the regex you want to find this specific string inside. But you're right that it's not needed here.","created_at":"2015-06-17T16:50:40Z","updated_at":"2015-06-17T16:50:40Z","html_url":"https://github.com/democracyworks/electorate-works/pull/1#discussion_r32647961","pull_request_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments/32647961"},"html":{"href":"https://github.com/democracyworks/electorate-works/pull/1#discussion_r32647961"},"pull_request":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1","id":37724911,"html_url":"https://github.com/democracyworks/electorate-works/pull/1","diff_url":"https://github.com/democracyworks/electorate-works/pull/1.diff","patch_url":"https://github.com/democracyworks/electorate-works/pull/1.patch","issue_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/1","number":1,"state":"open","locked":false,"title":"[TH] add create and delete queues and datomic fns","user":{"login":"tank157","id":4147,"avatar_url":"https://avatars.githubusercontent.com/u/4147?v=3","gravatar_id":"","url":"https://api.github.com/users/tank157","html_url":"https://github.com/tank157","followers_url":"https://api.github.com/users/tank157/followers","following_url":"https://api.github.com/users/tank157/following{/other_user}","gists_url":"https://api.github.com/users/tank157/gists{/gist_id}","starred_url":"https://api.github.com/users/tank157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tank157/subscriptions","organizations_url":"https://api.github.com/users/tank157/orgs","repos_url":"https://api.github.com/users/tank157/repos","events_url":"https://api.github.com/users/tank157/events{/privacy}","received_events_url":"https://api.github.com/users/tank157/received_events","type":"User","site_admin":false},"body":"[Pivotal Card](https://www.pivotaltracker.com/story/show/91604100)\r\n\r\nAssigning to @tie-rack ","created_at":"2015-06-15T19:12:30Z","updated_at":"2015-06-17T16:50:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"852703eba62cd32f83ef060d28947ca874fd6ca6","assignee":{"login":"tie-rack","id":3526,"avatar_url":"https://avatars.githubusercontent.com/u/3526?v=3","gravatar_id":"","url":"https://api.github.com/users/tie-rack","html_url":"https://github.com/tie-rack","followers_url":"https://api.github.com/users/tie-rack/followers","following_url":"https://api.github.com/users/tie-rack/following{/other_user}","gists_url":"https://api.github.com/users/tie-rack/gists{/gist_id}","starred_url":"https://api.github.com/users/tie-rack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tie-rack/subscriptions","organizations_url":"https://api.github.com/users/tie-rack/orgs","repos_url":"https://api.github.com/users/tie-rack/repos","events_url":"https://api.github.com/users/tie-rack/events{/privacy}","received_events_url":"https://api.github.com/users/tie-rack/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1/commits","review_comments_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1/comments","review_comment_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments{/number}","comments_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/1/comments","statuses_url":"https://api.github.com/repos/democracyworks/electorate-works/statuses/96aa3a7499fdfd98868f5a889132060c8793f570","head":{"label":"democracyworks:add-queues","ref":"add-queues","sha":"96aa3a7499fdfd98868f5a889132060c8793f570","user":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"repo":{"id":37331127,"name":"electorate-works","full_name":"democracyworks/electorate-works","owner":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/democracyworks/electorate-works","description":"","fork":false,"url":"https://api.github.com/repos/democracyworks/electorate-works","forks_url":"https://api.github.com/repos/democracyworks/electorate-works/forks","keys_url":"https://api.github.com/repos/democracyworks/electorate-works/keys{/key_id}","collaborators_url":"https://api.github.com/repos/democracyworks/electorate-works/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/democracyworks/electorate-works/teams","hooks_url":"https://api.github.com/repos/democracyworks/electorate-works/hooks","issue_events_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/events{/number}","events_url":"https://api.github.com/repos/democracyworks/electorate-works/events","assignees_url":"https://api.github.com/repos/democracyworks/electorate-works/assignees{/user}","branches_url":"https://api.github.com/repos/democracyworks/electorate-works/branches{/branch}","tags_url":"https://api.github.com/repos/democracyworks/electorate-works/tags","blobs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/democracyworks/electorate-works/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/refs{/sha}","trees_url":"https://api.github.com/repos/democracyworks/electorate-works/git/trees{/sha}","statuses_url":"https://api.github.com/repos/democracyworks/electorate-works/statuses/{sha}","languages_url":"https://api.github.com/repos/democracyworks/electorate-works/languages","stargazers_url":"https://api.github.com/repos/democracyworks/electorate-works/stargazers","contributors_url":"https://api.github.com/repos/democracyworks/electorate-works/contributors","subscribers_url":"https://api.github.com/repos/democracyworks/electorate-works/subscribers","subscription_url":"https://api.github.com/repos/democracyworks/electorate-works/subscription","commits_url":"https://api.github.com/repos/democracyworks/electorate-works/commits{/sha}","git_commits_url":"https://api.github.com/repos/democracyworks/electorate-works/git/commits{/sha}","comments_url":"https://api.github.com/repos/democracyworks/electorate-works/comments{/number}","issue_comment_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/comments{/number}","contents_url":"https://api.github.com/repos/democracyworks/electorate-works/contents/{+path}","compare_url":"https://api.github.com/repos/democracyworks/electorate-works/compare/{base}...{head}","merges_url":"https://api.github.com/repos/democracyworks/electorate-works/merges","archive_url":"https://api.github.com/repos/democracyworks/electorate-works/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/democracyworks/electorate-works/downloads","issues_url":"https://api.github.com/repos/democracyworks/electorate-works/issues{/number}","pulls_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls{/number}","milestones_url":"https://api.github.com/repos/democracyworks/electorate-works/milestones{/number}","notifications_url":"https://api.github.com/repos/democracyworks/electorate-works/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/democracyworks/electorate-works/labels{/name}","releases_url":"https://api.github.com/repos/democracyworks/electorate-works/releases{/id}","created_at":"2015-06-12T15:58:32Z","updated_at":"2015-06-12T15:59:57Z","pushed_at":"2015-06-17T16:14:31Z","git_url":"git://github.com/democracyworks/electorate-works.git","ssh_url":"git@github.com:democracyworks/electorate-works.git","clone_url":"https://github.com/democracyworks/electorate-works.git","svn_url":"https://github.com/democracyworks/electorate-works","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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":"democracyworks:master","ref":"master","sha":"978a950b866e5b782dccdb0363b69f0cb433133e","user":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"repo":{"id":37331127,"name":"electorate-works","full_name":"democracyworks/electorate-works","owner":{"login":"democracyworks","id":1373557,"avatar_url":"https://avatars.githubusercontent.com/u/1373557?v=3","gravatar_id":"","url":"https://api.github.com/users/democracyworks","html_url":"https://github.com/democracyworks","followers_url":"https://api.github.com/users/democracyworks/followers","following_url":"https://api.github.com/users/democracyworks/following{/other_user}","gists_url":"https://api.github.com/users/democracyworks/gists{/gist_id}","starred_url":"https://api.github.com/users/democracyworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/democracyworks/subscriptions","organizations_url":"https://api.github.com/users/democracyworks/orgs","repos_url":"https://api.github.com/users/democracyworks/repos","events_url":"https://api.github.com/users/democracyworks/events{/privacy}","received_events_url":"https://api.github.com/users/democracyworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/democracyworks/electorate-works","description":"","fork":false,"url":"https://api.github.com/repos/democracyworks/electorate-works","forks_url":"https://api.github.com/repos/democracyworks/electorate-works/forks","keys_url":"https://api.github.com/repos/democracyworks/electorate-works/keys{/key_id}","collaborators_url":"https://api.github.com/repos/democracyworks/electorate-works/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/democracyworks/electorate-works/teams","hooks_url":"https://api.github.com/repos/democracyworks/electorate-works/hooks","issue_events_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/events{/number}","events_url":"https://api.github.com/repos/democracyworks/electorate-works/events","assignees_url":"https://api.github.com/repos/democracyworks/electorate-works/assignees{/user}","branches_url":"https://api.github.com/repos/democracyworks/electorate-works/branches{/branch}","tags_url":"https://api.github.com/repos/democracyworks/electorate-works/tags","blobs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/democracyworks/electorate-works/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/democracyworks/electorate-works/git/refs{/sha}","trees_url":"https://api.github.com/repos/democracyworks/electorate-works/git/trees{/sha}","statuses_url":"https://api.github.com/repos/democracyworks/electorate-works/statuses/{sha}","languages_url":"https://api.github.com/repos/democracyworks/electorate-works/languages","stargazers_url":"https://api.github.com/repos/democracyworks/electorate-works/stargazers","contributors_url":"https://api.github.com/repos/democracyworks/electorate-works/contributors","subscribers_url":"https://api.github.com/repos/democracyworks/electorate-works/subscribers","subscription_url":"https://api.github.com/repos/democracyworks/electorate-works/subscription","commits_url":"https://api.github.com/repos/democracyworks/electorate-works/commits{/sha}","git_commits_url":"https://api.github.com/repos/democracyworks/electorate-works/git/commits{/sha}","comments_url":"https://api.github.com/repos/democracyworks/electorate-works/comments{/number}","issue_comment_url":"https://api.github.com/repos/democracyworks/electorate-works/issues/comments{/number}","contents_url":"https://api.github.com/repos/democracyworks/electorate-works/contents/{+path}","compare_url":"https://api.github.com/repos/democracyworks/electorate-works/compare/{base}...{head}","merges_url":"https://api.github.com/repos/democracyworks/electorate-works/merges","archive_url":"https://api.github.com/repos/democracyworks/electorate-works/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/democracyworks/electorate-works/downloads","issues_url":"https://api.github.com/repos/democracyworks/electorate-works/issues{/number}","pulls_url":"https://api.github.com/repos/democracyworks/electorate-works/pulls{/number}","milestones_url":"https://api.github.com/repos/democracyworks/electorate-works/milestones{/number}","notifications_url":"https://api.github.com/repos/democracyworks/electorate-works/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/democracyworks/electorate-works/labels{/name}","releases_url":"https://api.github.com/repos/democracyworks/electorate-works/releases{/id}","created_at":"2015-06-12T15:58:32Z","updated_at":"2015-06-12T15:59:57Z","pushed_at":"2015-06-17T16:14:31Z","git_url":"git://github.com/democracyworks/electorate-works.git","ssh_url":"git@github.com:democracyworks/electorate-works.git","clone_url":"https://github.com/democracyworks/electorate-works.git","svn_url":"https://github.com/democracyworks/electorate-works","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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/democracyworks/electorate-works/pulls/1"},"html":{"href":"https://github.com/democracyworks/electorate-works/pull/1"},"issue":{"href":"https://api.github.com/repos/democracyworks/electorate-works/issues/1"},"comments":{"href":"https://api.github.com/repos/democracyworks/electorate-works/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/democracyworks/electorate-works/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/democracyworks/electorate-works/statuses/96aa3a7499fdfd98868f5a889132060c8793f570"}}}}