{"action":"created","comment":{"url":"https://api.github.com/repos/democracyworks/mail-works/pulls/comments/66652889","id":66652889,"diff_hunk":"@@ -0,0 +1,69 @@\n+(ns mail-works.handlers.schedule-test\n+  (:require [mail-works.handlers.schedule :refer :all]\n+            [clojure.test :refer :all]\n+            [schema.core :as s]))\n+\n+(deftest schedule-schema-test\n+  (testing \"passes validation when scheduling update\"\n+    (is (s/validate schedule-schema\n+                    {:send-after #inst \"2016-10-04\"\n+                     :send-to \"election-mail-works.events.electorate-update\"\n+                     :send-before #inst \"2016-10-27\"\n+                     :identifiers {:user-id (str (java.util.UUID/randomUUID))\n+                                   :mailing-type :election}\n+                     :form-type :nm_absentee\n+                     :user {:first-name \"Grace\"\n+                            :last-name \"Hopper\"\n+                            :nickname \"The Compiler\"\n+                            :addresses {:registered {:street \"123 Main St\"\n+                                                     :city \"Alamogordo\"\n+                                                     :state \"NM\"\n+                                                     :zip \"78123\"}}}\n+                     :election-authority {:office-name \"Election Office\"\n+                                          :district-division\n+                                          {:description\n+                                           \"Land o Enchantment\"}\n+                                          :physical-address\n+                                          {:street \"456 Lane St\"\n+                                           :city \"Alamogordo\"\n+                                           :state \"NM\"\n+                                           :zip \"78123\"}}\n+                     :language :es})))\n+  (testing \"passes validation when scheduling the actual mailing\"\n+    (is (s/validate schedule-schema\n+                    {:send-after #inst \"2016-10-04\"\n+                     :identifiers {:user-id (str (java.util.UUID/randomUUID))\n+                                   :mailing-type :election}\n+                     :files [\"cover-letter.pdf\" \"vbm.pdf\"]\n+                     :filename (str (java.util.UUID/randomUUID) \".pdf\")}))))\n+\n+(deftest ->schedule-message-test\n+  (testing \"defaults `:send-to` when not present\"\n+    (let [original {:send-after #inst \"2016-05-09T12:00:00\"\n+                    :identifiers {:user-id (java.util.UUID/randomUUID)}\n+                    :foo \"foo\"}\n+          scheduled (->schedule-message original)]\n+      (is (= \"mail-works.mailing.send\" (:send-to scheduled)))))\n+  (testing \"uses original `:send-to` when present\"\n+    (let [original {:send-to \"some.other.place\"\n+                    :send-after #inst \"2016-05-09T12:00:00\"\n+                    :identifiers {:user-id (java.util.UUID/randomUUID)}\n+                    :foo \"foo\"}\n+          scheduled (->schedule-message original)]\n+      (is (= \"some.other.place\" (:send-to scheduled)))))\n+  (testing \"scheduling components stay at top level\"","path":"test/mail_works/handlers/schedule_test.clj","position":54,"original_position":54,"commit_id":"d2c89a67e6e5f28834ebbbd05b634e9f498934da","original_commit_id":"d2c89a67e6e5f28834ebbbd05b634e9f498934da","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":"Top level is referring to the top level of the resulting map (ie, the keys accessible directly at the root of the \"tree\"). Since the function I'm testing is all about restructuring the original message to go to scheduled message works, this is just my way of testing that the things scheduled message works cares about (:send-to, :identifiers) are present at the root level post transformation.","created_at":"2016-06-10T17:42:39Z","updated_at":"2016-06-10T17:42:39Z","html_url":"https://github.com/democracyworks/mail-works/pull/2#discussion_r66652889","pull_request_url":"https://api.github.com/repos/democracyworks/mail-works/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/democracyworks/mail-works/pulls/comments/66652889"},"html":{"href":"https://github.com/democracyworks/mail-works/pull/2#discussion_r66652889"},"pull_request":{"href":"https://api.github.com/repos/democracyworks/mail-works/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/democracyworks/mail-works/pulls/2","id":72902098,"html_url":"https://github.com/democracyworks/mail-works/pull/2","diff_url":"https://github.com/democracyworks/mail-works/pull/2.diff","patch_url":"https://github.com/democracyworks/mail-works/pull/2.patch","issue_url":"https://api.github.com/repos/democracyworks/mail-works/issues/2","number":2,"state":"open","locked":false,"title":"Electorate events","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/118437067)","created_at":"2016-06-07T15:58:18Z","updated_at":"2016-06-10T17:42:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4876e47b2dac127b04d578d4da80995e0c9afa96","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/democracyworks/mail-works/pulls/2/commits","review_comments_url":"https://api.github.com/repos/democracyworks/mail-works/pulls/2/comments","review_comment_url":"https://api.github.com/repos/democracyworks/mail-works/pulls/comments{/number}","comments_url":"https://api.github.com/repos/democracyworks/mail-works/issues/2/comments","statuses_url":"https://api.github.com/repos/democracyworks/mail-works/statuses/d2c89a67e6e5f28834ebbbd05b634e9f498934da","head":{"label":"democracyworks:electorate-events","ref":"electorate-events","sha":"d2c89a67e6e5f28834ebbbd05b634e9f498934da","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":58067949,"name":"mail-works","full_name":"democracyworks/mail-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/mail-works","description":"mailing pdfs for great good!","fork":false,"url":"https://api.github.com/repos/democracyworks/mail-works","forks_url":"https://api.github.com/repos/democracyworks/mail-works/forks","keys_url":"https://api.github.com/repos/democracyworks/mail-works/keys{/key_id}","collaborators_url":"https://api.github.com/repos/democracyworks/mail-works/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/democracyworks/mail-works/teams","hooks_url":"https://api.github.com/repos/democracyworks/mail-works/hooks","issue_events_url":"https://api.github.com/repos/democracyworks/mail-works/issues/events{/number}","events_url":"https://api.github.com/repos/democracyworks/mail-works/events","assignees_url":"https://api.github.com/repos/democracyworks/mail-works/assignees{/user}","branches_url":"https://api.github.com/repos/democracyworks/mail-works/branches{/branch}","tags_url":"https://api.github.com/repos/democracyworks/mail-works/tags","blobs_url":"https://api.github.com/repos/democracyworks/mail-works/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/democracyworks/mail-works/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/democracyworks/mail-works/git/refs{/sha}","trees_url":"https://api.github.com/repos/democracyworks/mail-works/git/trees{/sha}","statuses_url":"https://api.github.com/repos/democracyworks/mail-works/statuses/{sha}","languages_url":"https://api.github.com/repos/democracyworks/mail-works/languages","stargazers_url":"https://api.github.com/repos/democracyworks/mail-works/stargazers","contributors_url":"https://api.github.com/repos/democracyworks/mail-works/contributors","subscribers_url":"https://api.github.com/repos/democracyworks/mail-works/subscribers","subscription_url":"https://api.github.com/repos/democracyworks/mail-works/subscription","commits_url":"https://api.github.com/repos/democracyworks/mail-works/commits{/sha}","git_commits_url":"https://api.github.com/repos/democracyworks/mail-works/git/commits{/sha}","comments_url":"https://api.github.com/repos/democracyworks/mail-works/comments{/number}","issue_comment_url":"https://api.github.com/repos/democracyworks/mail-works/issues/comments{/number}","contents_url":"https://api.github.com/repos/democracyworks/mail-works/contents/{+path}","compare_url":"https://api.github.com/repos/democracyworks/mail-works/compare/{base}...{head}","merges_url":"https://api.github.com/repos/democracyworks/mail-works/merges","archive_url":"https://api.github.com/repos/democracyworks/mail-works/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/democracyworks/mail-works/downloads","issues_url":"https://api.github.com/repos/democracyworks/mail-works/issues{/number}","pulls_url":"https://api.github.com/repos/democracyworks/mail-works/pulls{/number}","milestones_url":"https://api.github.com/repos/democracyworks/mail-works/milestones{/number}","notifications_url":"https://api.github.com/repos/democracyworks/mail-works/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/democracyworks/mail-works/labels{/name}","releases_url":"https://api.github.com/repos/democracyworks/mail-works/releases{/id}","deployments_url":"https://api.github.com/repos/democracyworks/mail-works/deployments","created_at":"2016-05-04T16:40:06Z","updated_at":"2016-05-04T16:40:28Z","pushed_at":"2016-06-08T19:54:09Z","git_url":"git://github.com/democracyworks/mail-works.git","ssh_url":"git@github.com:democracyworks/mail-works.git","clone_url":"https://github.com/democracyworks/mail-works.git","svn_url":"https://github.com/democracyworks/mail-works","homepage":null,"size":33,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"democracyworks:master","ref":"master","sha":"51fb83f55d420d37c85e0c87567a40ed0bbad540","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":58067949,"name":"mail-works","full_name":"democracyworks/mail-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/mail-works","description":"mailing pdfs for great good!","fork":false,"url":"https://api.github.com/repos/democracyworks/mail-works","forks_url":"https://api.github.com/repos/democracyworks/mail-works/forks","keys_url":"https://api.github.com/repos/democracyworks/mail-works/keys{/key_id}","collaborators_url":"https://api.github.com/repos/democracyworks/mail-works/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/democracyworks/mail-works/teams","hooks_url":"https://api.github.com/repos/democracyworks/mail-works/hooks","issue_events_url":"https://api.github.com/repos/democracyworks/mail-works/issues/events{/number}","events_url":"https://api.github.com/repos/democracyworks/mail-works/events","assignees_url":"https://api.github.com/repos/democracyworks/mail-works/assignees{/user}","branches_url":"https://api.github.com/repos/democracyworks/mail-works/branches{/branch}","tags_url":"https://api.github.com/repos/democracyworks/mail-works/tags","blobs_url":"https://api.github.com/repos/democracyworks/mail-works/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/democracyworks/mail-works/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/democracyworks/mail-works/git/refs{/sha}","trees_url":"https://api.github.com/repos/democracyworks/mail-works/git/trees{/sha}","statuses_url":"https://api.github.com/repos/democracyworks/mail-works/statuses/{sha}","languages_url":"https://api.github.com/repos/democracyworks/mail-works/languages","stargazers_url":"https://api.github.com/repos/democracyworks/mail-works/stargazers","contributors_url":"https://api.github.com/repos/democracyworks/mail-works/contributors","subscribers_url":"https://api.github.com/repos/democracyworks/mail-works/subscribers","subscription_url":"https://api.github.com/repos/democracyworks/mail-works/subscription","commits_url":"https://api.github.com/repos/democracyworks/mail-works/commits{/sha}","git_commits_url":"https://api.github.com/repos/democracyworks/mail-works/git/commits{/sha}","comments_url":"https://api.github.com/repos/democracyworks/mail-works/comments{/number}","issue_comment_url":"https://api.github.com/repos/democracyworks/mail-works/issues/comments{/number}","contents_url":"https://api.github.com/repos/democracyworks/mail-works/contents/{+path}","compare_url":"https://api.github.com/repos/democracyworks/mail-works/compare/{base}...{head}","merges_url":"https://api.github.com/repos/democracyworks/mail-works/merges","archive_url":"https://api.github.com/repos/democracyworks/mail-works/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/democracyworks/mail-works/downloads","issues_url":"https://api.github.com/repos/democracyworks/mail-works/issues{/number}","pulls_url":"https://api.github.com/repos/democracyworks/mail-works/pulls{/number}","milestones_url":"https://api.github.com/repos/democracyworks/mail-works/milestones{/number}","notifications_url":"https://api.github.com/repos/democracyworks/mail-works/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/democracyworks/mail-works/labels{/name}","releases_url":"https://api.github.com/repos/democracyworks/mail-works/releases{/id}","deployments_url":"https://api.github.com/repos/democracyworks/mail-works/deployments","created_at":"2016-05-04T16:40:06Z","updated_at":"2016-05-04T16:40:28Z","pushed_at":"2016-06-08T19:54:09Z","git_url":"git://github.com/democracyworks/mail-works.git","ssh_url":"git@github.com:democracyworks/mail-works.git","clone_url":"https://github.com/democracyworks/mail-works.git","svn_url":"https://github.com/democracyworks/mail-works","homepage":null,"size":33,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/democracyworks/mail-works/pulls/2"},"html":{"href":"https://github.com/democracyworks/mail-works/pull/2"},"issue":{"href":"https://api.github.com/repos/democracyworks/mail-works/issues/2"},"comments":{"href":"https://api.github.com/repos/democracyworks/mail-works/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/democracyworks/mail-works/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/democracyworks/mail-works/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/democracyworks/mail-works/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/democracyworks/mail-works/statuses/d2c89a67e6e5f28834ebbbd05b634e9f498934da"}}}}
{"actor":{"display_login":"tank157"}}