{"action":"created","comment":{"url":"https://api.github.com/repos/klarna/eremetic/pulls/comments/77301000","id":77301000,"diff_hunk":"@@ -65,266 +64,279 @@ func TestHandling(t *testing.T) {\n \t}\n \th := Create(scheduler, db)\n \n-\tdb.Clean()\n \tdefer db.Close()\n \n-\tConvey(\"writeJSON\", t, func() {\n-\t\tConvey(\"Should respond with a JSON and the appropriate status code\", func() {\n-\t\t\tvar wr = httptest.NewRecorder()\n-\n-\t\t\twriteJSON(200, \"foo\", wr)\n-\t\t\tcontentType := wr.HeaderMap[\"Content-Type\"][0]\n-\t\t\tSo(contentType, ShouldEqual, \"application/json; charset=UTF-8\")\n-\t\t\tSo(wr.Code, ShouldEqual, http.StatusOK)\n-\t\t})\n-\t})\n+\tConvey(\"Routes\", t, func() {\n+\t\tdb.Clean()\n \n-\tConvey(\"HandleError\", t, func() {\n \t\twr := httptest.NewRecorder()\n-\n-\t\tConvey(\"It should return an error status code\", func() {\n-\t\t\tvar err = mockError{\n-\t\t\t\tmessage: \"Error\",\n-\t\t\t}\n-\n-\t\t\thandleError(err, wr, \"A test error\")\n-\n-\t\t\tSo(wr.Code, ShouldEqual, 422)\n-\t\t\tSo(strings.TrimSpace(wr.Body.String()), ShouldEqual, \"{\\\"error\\\":\\\"Error\\\",\\\"message\\\":\\\"A test error\\\"}\")\n-\t\t})\n-\t})\n-\n-\tConvey(\"GetTaskInfo\", t, func() {\n-\t\twr := httptest.NewRecorder()\n-\t\tr, _ := http.NewRequest(\"GET\", \"/task/eremetic-task.1234\", nil)\n \t\tm := mux.NewRouter()\n-\t\tm.HandleFunc(\"/task/{taskId}\", h.GetTaskInfo(&config.Config{}))\n-\n-\t\tConvey(\"Not Found\", func() {\n-\t\t\tid := \"eremetic-task.5678\"\n-\t\t\ttask := types.EremeticTask{\n-\t\t\t\tTaskCPUs: 0.2,\n-\t\t\t\tTaskMem:  0.5,\n-\t\t\t\tCommand:  \"test\",\n-\t\t\t\tImage:    \"test\",\n-\t\t\t\tStatus:   status,\n-\t\t\t\tID:       id,\n-\t\t\t}\n-\t\t\tdb.PutTask(&task)\n-\t\t\tm.ServeHTTP(wr, r)\n \n-\t\t\tSo(wr.Code, ShouldEqual, http.StatusNotFound)\n+\t\tConvey(\"GetTaskInfo\", func() {\n+\t\t\tr, _ := http.NewRequest(\"GET\", \"/task/eremetic-task.1234\", nil)\n+\t\t\tm.HandleFunc(\"/task/{taskId}\", h.GetTaskInfo(&config.Config{}))\n+\n+\t\t\tConvey(\"JSON request\", func() {\n+\t\t\t\tConvey(\"Not Found\", func() {\n+\t\t\t\t\tid := \"eremetic-task.5678\"","path":"handler/handler_test.go","position":71,"original_position":71,"commit_id":"e8b781090b5518838f89c831a7eeb519c52007dd","original_commit_id":"e8b781090b5518838f89c831a7eeb519c52007dd","user":{"login":"keis","id":125062,"avatar_url":"https://avatars.githubusercontent.com/u/125062?v=3","gravatar_id":"","url":"https://api.github.com/users/keis","html_url":"https://github.com/keis","followers_url":"https://api.github.com/users/keis/followers","following_url":"https://api.github.com/users/keis/following{/other_user}","gists_url":"https://api.github.com/users/keis/gists{/gist_id}","starred_url":"https://api.github.com/users/keis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keis/subscriptions","organizations_url":"https://api.github.com/users/keis/orgs","repos_url":"https://api.github.com/users/keis/repos","events_url":"https://api.github.com/users/keis/events{/privacy}","received_events_url":"https://api.github.com/users/keis/received_events","type":"User","site_admin":false},"body":"Maybe it would be cleaner to initialise the test state in `GetTaskInfo` and change the requested url for not found? Could also share the setup between html/json that way","created_at":"2016-09-02T06:52:48Z","updated_at":"2016-09-02T06:52:48Z","html_url":"https://github.com/klarna/eremetic/pull/121#discussion_r77301000","pull_request_url":"https://api.github.com/repos/klarna/eremetic/pulls/121","_links":{"self":{"href":"https://api.github.com/repos/klarna/eremetic/pulls/comments/77301000"},"html":{"href":"https://github.com/klarna/eremetic/pull/121#discussion_r77301000"},"pull_request":{"href":"https://api.github.com/repos/klarna/eremetic/pulls/121"}}},"pull_request":{"url":"https://api.github.com/repos/klarna/eremetic/pulls/121","id":83690084,"html_url":"https://github.com/klarna/eremetic/pull/121","diff_url":"https://github.com/klarna/eremetic/pull/121.diff","patch_url":"https://github.com/klarna/eremetic/pull/121.patch","issue_url":"https://api.github.com/repos/klarna/eremetic/issues/121","number":121,"state":"open","locked":false,"title":"Unify the building of routes","user":{"login":"alde","id":350296,"avatar_url":"https://avatars.githubusercontent.com/u/350296?v=3","gravatar_id":"","url":"https://api.github.com/users/alde","html_url":"https://github.com/alde","followers_url":"https://api.github.com/users/alde/followers","following_url":"https://api.github.com/users/alde/following{/other_user}","gists_url":"https://api.github.com/users/alde/gists{/gist_id}","starred_url":"https://api.github.com/users/alde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alde/subscriptions","organizations_url":"https://api.github.com/users/alde/orgs","repos_url":"https://api.github.com/users/alde/repos","events_url":"https://api.github.com/users/alde/events{/privacy}","received_events_url":"https://api.github.com/users/alde/received_events","type":"User","site_admin":false},"body":"Add some missing tests\r\n\r\nFixes #45\r\n\r\nRevert -trace in tests","created_at":"2016-09-01T19:13:46Z","updated_at":"2016-09-02T06:52:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffd028def4eb498705727c5c71177e597ab38205","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/klarna/eremetic/pulls/121/commits","review_comments_url":"https://api.github.com/repos/klarna/eremetic/pulls/121/comments","review_comment_url":"https://api.github.com/repos/klarna/eremetic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/klarna/eremetic/issues/121/comments","statuses_url":"https://api.github.com/repos/klarna/eremetic/statuses/e8b781090b5518838f89c831a7eeb519c52007dd","head":{"label":"klarna:restructure-routes","ref":"restructure-routes","sha":"e8b781090b5518838f89c831a7eeb519c52007dd","user":{"login":"klarna","id":394540,"avatar_url":"https://avatars.githubusercontent.com/u/394540?v=3","gravatar_id":"","url":"https://api.github.com/users/klarna","html_url":"https://github.com/klarna","followers_url":"https://api.github.com/users/klarna/followers","following_url":"https://api.github.com/users/klarna/following{/other_user}","gists_url":"https://api.github.com/users/klarna/gists{/gist_id}","starred_url":"https://api.github.com/users/klarna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klarna/subscriptions","organizations_url":"https://api.github.com/users/klarna/orgs","repos_url":"https://api.github.com/users/klarna/repos","events_url":"https://api.github.com/users/klarna/events{/privacy}","received_events_url":"https://api.github.com/users/klarna/received_events","type":"Organization","site_admin":false},"repo":{"id":44609170,"name":"eremetic","full_name":"klarna/eremetic","owner":{"login":"klarna","id":394540,"avatar_url":"https://avatars.githubusercontent.com/u/394540?v=3","gravatar_id":"","url":"https://api.github.com/users/klarna","html_url":"https://github.com/klarna","followers_url":"https://api.github.com/users/klarna/followers","following_url":"https://api.github.com/users/klarna/following{/other_user}","gists_url":"https://api.github.com/users/klarna/gists{/gist_id}","starred_url":"https://api.github.com/users/klarna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klarna/subscriptions","organizations_url":"https://api.github.com/users/klarna/orgs","repos_url":"https://api.github.com/users/klarna/repos","events_url":"https://api.github.com/users/klarna/events{/privacy}","received_events_url":"https://api.github.com/users/klarna/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/klarna/eremetic","description":"A Framework for Mesos to run one-off tasks in docker","fork":false,"url":"https://api.github.com/repos/klarna/eremetic","forks_url":"https://api.github.com/repos/klarna/eremetic/forks","keys_url":"https://api.github.com/repos/klarna/eremetic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klarna/eremetic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klarna/eremetic/teams","hooks_url":"https://api.github.com/repos/klarna/eremetic/hooks","issue_events_url":"https://api.github.com/repos/klarna/eremetic/issues/events{/number}","events_url":"https://api.github.com/repos/klarna/eremetic/events","assignees_url":"https://api.github.com/repos/klarna/eremetic/assignees{/user}","branches_url":"https://api.github.com/repos/klarna/eremetic/branches{/branch}","tags_url":"https://api.github.com/repos/klarna/eremetic/tags","blobs_url":"https://api.github.com/repos/klarna/eremetic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klarna/eremetic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klarna/eremetic/git/refs{/sha}","trees_url":"https://api.github.com/repos/klarna/eremetic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klarna/eremetic/statuses/{sha}","languages_url":"https://api.github.com/repos/klarna/eremetic/languages","stargazers_url":"https://api.github.com/repos/klarna/eremetic/stargazers","contributors_url":"https://api.github.com/repos/klarna/eremetic/contributors","subscribers_url":"https://api.github.com/repos/klarna/eremetic/subscribers","subscription_url":"https://api.github.com/repos/klarna/eremetic/subscription","commits_url":"https://api.github.com/repos/klarna/eremetic/commits{/sha}","git_commits_url":"https://api.github.com/repos/klarna/eremetic/git/commits{/sha}","comments_url":"https://api.github.com/repos/klarna/eremetic/comments{/number}","issue_comment_url":"https://api.github.com/repos/klarna/eremetic/issues/comments{/number}","contents_url":"https://api.github.com/repos/klarna/eremetic/contents/{+path}","compare_url":"https://api.github.com/repos/klarna/eremetic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klarna/eremetic/merges","archive_url":"https://api.github.com/repos/klarna/eremetic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klarna/eremetic/downloads","issues_url":"https://api.github.com/repos/klarna/eremetic/issues{/number}","pulls_url":"https://api.github.com/repos/klarna/eremetic/pulls{/number}","milestones_url":"https://api.github.com/repos/klarna/eremetic/milestones{/number}","notifications_url":"https://api.github.com/repos/klarna/eremetic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klarna/eremetic/labels{/name}","releases_url":"https://api.github.com/repos/klarna/eremetic/releases{/id}","deployments_url":"https://api.github.com/repos/klarna/eremetic/deployments","created_at":"2015-10-20T13:45:17Z","updated_at":"2016-08-31T05:23:57Z","pushed_at":"2016-09-01T19:13:46Z","git_url":"git://github.com/klarna/eremetic.git","ssh_url":"git@github.com:klarna/eremetic.git","clone_url":"https://github.com/klarna/eremetic.git","svn_url":"https://github.com/klarna/eremetic","homepage":null,"size":3098,"stargazers_count":72,"watchers_count":72,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":17,"forks":15,"open_issues":17,"watchers":72,"default_branch":"master"}},"base":{"label":"klarna:master","ref":"master","sha":"6b6609f06132f59638f1e5a2874b761eabed52c9","user":{"login":"klarna","id":394540,"avatar_url":"https://avatars.githubusercontent.com/u/394540?v=3","gravatar_id":"","url":"https://api.github.com/users/klarna","html_url":"https://github.com/klarna","followers_url":"https://api.github.com/users/klarna/followers","following_url":"https://api.github.com/users/klarna/following{/other_user}","gists_url":"https://api.github.com/users/klarna/gists{/gist_id}","starred_url":"https://api.github.com/users/klarna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klarna/subscriptions","organizations_url":"https://api.github.com/users/klarna/orgs","repos_url":"https://api.github.com/users/klarna/repos","events_url":"https://api.github.com/users/klarna/events{/privacy}","received_events_url":"https://api.github.com/users/klarna/received_events","type":"Organization","site_admin":false},"repo":{"id":44609170,"name":"eremetic","full_name":"klarna/eremetic","owner":{"login":"klarna","id":394540,"avatar_url":"https://avatars.githubusercontent.com/u/394540?v=3","gravatar_id":"","url":"https://api.github.com/users/klarna","html_url":"https://github.com/klarna","followers_url":"https://api.github.com/users/klarna/followers","following_url":"https://api.github.com/users/klarna/following{/other_user}","gists_url":"https://api.github.com/users/klarna/gists{/gist_id}","starred_url":"https://api.github.com/users/klarna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klarna/subscriptions","organizations_url":"https://api.github.com/users/klarna/orgs","repos_url":"https://api.github.com/users/klarna/repos","events_url":"https://api.github.com/users/klarna/events{/privacy}","received_events_url":"https://api.github.com/users/klarna/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/klarna/eremetic","description":"A Framework for Mesos to run one-off tasks in docker","fork":false,"url":"https://api.github.com/repos/klarna/eremetic","forks_url":"https://api.github.com/repos/klarna/eremetic/forks","keys_url":"https://api.github.com/repos/klarna/eremetic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klarna/eremetic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klarna/eremetic/teams","hooks_url":"https://api.github.com/repos/klarna/eremetic/hooks","issue_events_url":"https://api.github.com/repos/klarna/eremetic/issues/events{/number}","events_url":"https://api.github.com/repos/klarna/eremetic/events","assignees_url":"https://api.github.com/repos/klarna/eremetic/assignees{/user}","branches_url":"https://api.github.com/repos/klarna/eremetic/branches{/branch}","tags_url":"https://api.github.com/repos/klarna/eremetic/tags","blobs_url":"https://api.github.com/repos/klarna/eremetic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klarna/eremetic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klarna/eremetic/git/refs{/sha}","trees_url":"https://api.github.com/repos/klarna/eremetic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klarna/eremetic/statuses/{sha}","languages_url":"https://api.github.com/repos/klarna/eremetic/languages","stargazers_url":"https://api.github.com/repos/klarna/eremetic/stargazers","contributors_url":"https://api.github.com/repos/klarna/eremetic/contributors","subscribers_url":"https://api.github.com/repos/klarna/eremetic/subscribers","subscription_url":"https://api.github.com/repos/klarna/eremetic/subscription","commits_url":"https://api.github.com/repos/klarna/eremetic/commits{/sha}","git_commits_url":"https://api.github.com/repos/klarna/eremetic/git/commits{/sha}","comments_url":"https://api.github.com/repos/klarna/eremetic/comments{/number}","issue_comment_url":"https://api.github.com/repos/klarna/eremetic/issues/comments{/number}","contents_url":"https://api.github.com/repos/klarna/eremetic/contents/{+path}","compare_url":"https://api.github.com/repos/klarna/eremetic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klarna/eremetic/merges","archive_url":"https://api.github.com/repos/klarna/eremetic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klarna/eremetic/downloads","issues_url":"https://api.github.com/repos/klarna/eremetic/issues{/number}","pulls_url":"https://api.github.com/repos/klarna/eremetic/pulls{/number}","milestones_url":"https://api.github.com/repos/klarna/eremetic/milestones{/number}","notifications_url":"https://api.github.com/repos/klarna/eremetic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klarna/eremetic/labels{/name}","releases_url":"https://api.github.com/repos/klarna/eremetic/releases{/id}","deployments_url":"https://api.github.com/repos/klarna/eremetic/deployments","created_at":"2015-10-20T13:45:17Z","updated_at":"2016-08-31T05:23:57Z","pushed_at":"2016-09-01T19:13:46Z","git_url":"git://github.com/klarna/eremetic.git","ssh_url":"git@github.com:klarna/eremetic.git","clone_url":"https://github.com/klarna/eremetic.git","svn_url":"https://github.com/klarna/eremetic","homepage":null,"size":3098,"stargazers_count":72,"watchers_count":72,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":17,"forks":15,"open_issues":17,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/klarna/eremetic/pulls/121"},"html":{"href":"https://github.com/klarna/eremetic/pull/121"},"issue":{"href":"https://api.github.com/repos/klarna/eremetic/issues/121"},"comments":{"href":"https://api.github.com/repos/klarna/eremetic/issues/121/comments"},"review_comments":{"href":"https://api.github.com/repos/klarna/eremetic/pulls/121/comments"},"review_comment":{"href":"https://api.github.com/repos/klarna/eremetic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/klarna/eremetic/pulls/121/commits"},"statuses":{"href":"https://api.github.com/repos/klarna/eremetic/statuses/e8b781090b5518838f89c831a7eeb519c52007dd"}}}}
{"actor":{"display_login":"keis"}}