{"action":"created","comment":{"url":"https://api.github.com/repos/quintilesims/layer0/pulls/comments/145837987","pull_request_review_id":70694760,"id":145837987,"diff_hunk":"@@ -0,0 +1,295 @@\n+package command\n+\n+import (\n+\t\"testing\"\n+\n+\t\"github.com/quintilesims/layer0/common/models\"\n+\t\"github.com/stretchr/testify/assert\"\n+\t\"github.com/urfave/cli\"\n+)\n+\n+func TestCreateTask(t *testing.T) {\n+\ttestWaitHelper(t, func(t *testing.T, wait bool) {\n+\t\tbase, ctrl := newTestCommand(t)\n+\t\tdefer ctrl.Finish()\n+\t\ttaskCommand := NewTaskCommand(base.Command())\n+\t\targs := Args{\"env_name\", \"dpl_name\", \"task_name\"}\n+\t\tflags := Flags{\n+\t\t\t\"copies\": 1,\n+\t\t\t\"env\":    []string{\"container:key=val\"},\n+\t\t}\n+\t\toverrides := []models.ContainerOverride{{\n+\t\t\tContainerName:        \"container\",\n+\t\t\tEnvironmentOverrides: map[string]string{\"key\": \"val\"},\n+\t\t}}\n+\n+\t\treq := models.CreateTaskRequest{\n+\t\t\tTaskName:           \"task_name\",\n+\t\t\tDeployID:           \"dpl_id\",\n+\t\t\tEnvironmentID:      \"env_id\",\n+\t\t\tContainerOverrides: overrides,\n+\t\t}\n+\n+\t\tbase.Resolver.EXPECT().\n+\t\t\tResolve(\"deploy\", \"dpl_name\").\n+\t\t\tReturn(Args{\"dpl_id\"}, nil)\n+\n+\t\tbase.Resolver.EXPECT().\n+\t\t\tResolve(\"environment\", \"env_name\").\n+\t\t\tReturn(Args{\"env_id\"}, nil)\n+\n+\t\tbase.Client.EXPECT().\n+\t\t\tCreateTask(req).\n+\t\t\tReturn(\"job_id\", nil)\n+\n+\t\tif wait {\n+\t\t\tbase.Client.EXPECT().\n+\t\t\t\tReadJob(\"job_id\").\n+\t\t\t\tReturn(&models.Job{","path":"cli/command/task_test.go","position":48,"original_position":48,"commit_id":"27f72a1219ad8d676e379f1ff722a8325838f724","original_commit_id":"147e8735929e0db9c833501985718b91123186d7","user":{"login":"zpatrick","id":2894436,"avatar_url":"https://avatars2.githubusercontent.com/u/2894436?v=4","gravatar_id":"","url":"https://api.github.com/users/zpatrick","html_url":"https://github.com/zpatrick","followers_url":"https://api.github.com/users/zpatrick/followers","following_url":"https://api.github.com/users/zpatrick/following{/other_user}","gists_url":"https://api.github.com/users/zpatrick/gists{/gist_id}","starred_url":"https://api.github.com/users/zpatrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpatrick/subscriptions","organizations_url":"https://api.github.com/users/zpatrick/orgs","repos_url":"https://api.github.com/users/zpatrick/repos","events_url":"https://api.github.com/users/zpatrick/events{/privacy}","received_events_url":"https://api.github.com/users/zpatrick/received_events","type":"User","site_admin":false},"body":"we typically don't add multi-line objects in our mock-chains since it makes things so hard to read. \r\nAlso, don't use raw strings for the `job.Status` field (or `job.JobType` if you ever encounter that) - we have special types in the `api/job` package for that. \r\n\r\nFor example, this would be fine: \r\n```\r\nbase.Client.EXPECT().\r\n    ReadJob(\"job_id\").\r\n    Return(&models.Job{JobD: \"job_id\"}, nil)\r\n```\r\n\r\nbut this should be:\r\n```\r\njob := &models.Job{\r\n    Status: job.Completed.String(),\r\n    Result: \"task_id\",\r\n}\r\n\r\nbase.Client.EXPECT().\r\n    ReadJob(\"job_id\").\r\n    Return(job, nil)\r\n```","created_at":"2017-10-19T22:14:23Z","updated_at":"2017-10-19T22:39:00Z","html_url":"https://github.com/quintilesims/layer0/pull/387#discussion_r145837987","pull_request_url":"https://api.github.com/repos/quintilesims/layer0/pulls/387","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/quintilesims/layer0/pulls/comments/145837987"},"html":{"href":"https://github.com/quintilesims/layer0/pull/387#discussion_r145837987"},"pull_request":{"href":"https://api.github.com/repos/quintilesims/layer0/pulls/387"}}},"pull_request":{"url":"https://api.github.com/repos/quintilesims/layer0/pulls/387","id":145997785,"html_url":"https://github.com/quintilesims/layer0/pull/387","diff_url":"https://github.com/quintilesims/layer0/pull/387.diff","patch_url":"https://github.com/quintilesims/layer0/pull/387.patch","issue_url":"https://api.github.com/repos/quintilesims/layer0/issues/387","number":387,"state":"open","locked":false,"title":"Add cli command task","user":{"login":"nehayward","id":6733030,"avatar_url":"https://avatars1.githubusercontent.com/u/6733030?v=4","gravatar_id":"","url":"https://api.github.com/users/nehayward","html_url":"https://github.com/nehayward","followers_url":"https://api.github.com/users/nehayward/followers","following_url":"https://api.github.com/users/nehayward/following{/other_user}","gists_url":"https://api.github.com/users/nehayward/gists{/gist_id}","starred_url":"https://api.github.com/users/nehayward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nehayward/subscriptions","organizations_url":"https://api.github.com/users/nehayward/orgs","repos_url":"https://api.github.com/users/nehayward/repos","events_url":"https://api.github.com/users/nehayward/events{/privacy}","received_events_url":"https://api.github.com/users/nehayward/received_events","type":"User","site_admin":false},"body":"**What does this pull request do?**\r\nThis adds cli commands for CRD operations on task.\r\n\r\n**How should this be tested?**\r\nManually running `cd /cli && go run main.go` with various list, create, read, delete functions.\r\n\r\n\r\n**Checklist**\r\n- [x] Unit tests\r\n","created_at":"2017-10-11T16:19:14Z","updated_at":"2017-10-19T22:39:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de806b5156c51034fdd04c2511685506314c89f2","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/quintilesims/layer0/pulls/387/commits","review_comments_url":"https://api.github.com/repos/quintilesims/layer0/pulls/387/comments","review_comment_url":"https://api.github.com/repos/quintilesims/layer0/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quintilesims/layer0/issues/387/comments","statuses_url":"https://api.github.com/repos/quintilesims/layer0/statuses/27f72a1219ad8d676e379f1ff722a8325838f724","head":{"label":"quintilesims:add-task","ref":"add-task","sha":"27f72a1219ad8d676e379f1ff722a8325838f724","user":{"login":"quintilesims","id":23506699,"avatar_url":"https://avatars2.githubusercontent.com/u/23506699?v=4","gravatar_id":"","url":"https://api.github.com/users/quintilesims","html_url":"https://github.com/quintilesims","followers_url":"https://api.github.com/users/quintilesims/followers","following_url":"https://api.github.com/users/quintilesims/following{/other_user}","gists_url":"https://api.github.com/users/quintilesims/gists{/gist_id}","starred_url":"https://api.github.com/users/quintilesims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintilesims/subscriptions","organizations_url":"https://api.github.com/users/quintilesims/orgs","repos_url":"https://api.github.com/users/quintilesims/repos","events_url":"https://api.github.com/users/quintilesims/events{/privacy}","received_events_url":"https://api.github.com/users/quintilesims/received_events","type":"Organization","site_admin":false},"repo":{"id":74167056,"name":"layer0","full_name":"quintilesims/layer0","owner":{"login":"quintilesims","id":23506699,"avatar_url":"https://avatars2.githubusercontent.com/u/23506699?v=4","gravatar_id":"","url":"https://api.github.com/users/quintilesims","html_url":"https://github.com/quintilesims","followers_url":"https://api.github.com/users/quintilesims/followers","following_url":"https://api.github.com/users/quintilesims/following{/other_user}","gists_url":"https://api.github.com/users/quintilesims/gists{/gist_id}","starred_url":"https://api.github.com/users/quintilesims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintilesims/subscriptions","organizations_url":"https://api.github.com/users/quintilesims/orgs","repos_url":"https://api.github.com/users/quintilesims/repos","events_url":"https://api.github.com/users/quintilesims/events{/privacy}","received_events_url":"https://api.github.com/users/quintilesims/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/quintilesims/layer0","description":"Build, Manage, and Deploy Your Applications","fork":false,"url":"https://api.github.com/repos/quintilesims/layer0","forks_url":"https://api.github.com/repos/quintilesims/layer0/forks","keys_url":"https://api.github.com/repos/quintilesims/layer0/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quintilesims/layer0/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quintilesims/layer0/teams","hooks_url":"https://api.github.com/repos/quintilesims/layer0/hooks","issue_events_url":"https://api.github.com/repos/quintilesims/layer0/issues/events{/number}","events_url":"https://api.github.com/repos/quintilesims/layer0/events","assignees_url":"https://api.github.com/repos/quintilesims/layer0/assignees{/user}","branches_url":"https://api.github.com/repos/quintilesims/layer0/branches{/branch}","tags_url":"https://api.github.com/repos/quintilesims/layer0/tags","blobs_url":"https://api.github.com/repos/quintilesims/layer0/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quintilesims/layer0/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quintilesims/layer0/git/refs{/sha}","trees_url":"https://api.github.com/repos/quintilesims/layer0/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quintilesims/layer0/statuses/{sha}","languages_url":"https://api.github.com/repos/quintilesims/layer0/languages","stargazers_url":"https://api.github.com/repos/quintilesims/layer0/stargazers","contributors_url":"https://api.github.com/repos/quintilesims/layer0/contributors","subscribers_url":"https://api.github.com/repos/quintilesims/layer0/subscribers","subscription_url":"https://api.github.com/repos/quintilesims/layer0/subscription","commits_url":"https://api.github.com/repos/quintilesims/layer0/commits{/sha}","git_commits_url":"https://api.github.com/repos/quintilesims/layer0/git/commits{/sha}","comments_url":"https://api.github.com/repos/quintilesims/layer0/comments{/number}","issue_comment_url":"https://api.github.com/repos/quintilesims/layer0/issues/comments{/number}","contents_url":"https://api.github.com/repos/quintilesims/layer0/contents/{+path}","compare_url":"https://api.github.com/repos/quintilesims/layer0/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quintilesims/layer0/merges","archive_url":"https://api.github.com/repos/quintilesims/layer0/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quintilesims/layer0/downloads","issues_url":"https://api.github.com/repos/quintilesims/layer0/issues{/number}","pulls_url":"https://api.github.com/repos/quintilesims/layer0/pulls{/number}","milestones_url":"https://api.github.com/repos/quintilesims/layer0/milestones{/number}","notifications_url":"https://api.github.com/repos/quintilesims/layer0/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quintilesims/layer0/labels{/name}","releases_url":"https://api.github.com/repos/quintilesims/layer0/releases{/id}","deployments_url":"https://api.github.com/repos/quintilesims/layer0/deployments","created_at":"2016-11-18T21:18:34Z","updated_at":"2017-10-17T19:54:24Z","pushed_at":"2017-10-19T22:31:55Z","git_url":"git://github.com/quintilesims/layer0.git","ssh_url":"git@github.com:quintilesims/layer0.git","clone_url":"https://github.com/quintilesims/layer0.git","svn_url":"https://github.com/quintilesims/layer0","homepage":"","size":51454,"stargazers_count":23,"watchers_count":23,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":38,"forks":2,"open_issues":38,"watchers":23,"default_branch":"develop"}},"base":{"label":"quintilesims:cli-refactor","ref":"cli-refactor","sha":"d7d992bd1e286758879bc70917e30adfd33a9450","user":{"login":"quintilesims","id":23506699,"avatar_url":"https://avatars2.githubusercontent.com/u/23506699?v=4","gravatar_id":"","url":"https://api.github.com/users/quintilesims","html_url":"https://github.com/quintilesims","followers_url":"https://api.github.com/users/quintilesims/followers","following_url":"https://api.github.com/users/quintilesims/following{/other_user}","gists_url":"https://api.github.com/users/quintilesims/gists{/gist_id}","starred_url":"https://api.github.com/users/quintilesims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintilesims/subscriptions","organizations_url":"https://api.github.com/users/quintilesims/orgs","repos_url":"https://api.github.com/users/quintilesims/repos","events_url":"https://api.github.com/users/quintilesims/events{/privacy}","received_events_url":"https://api.github.com/users/quintilesims/received_events","type":"Organization","site_admin":false},"repo":{"id":74167056,"name":"layer0","full_name":"quintilesims/layer0","owner":{"login":"quintilesims","id":23506699,"avatar_url":"https://avatars2.githubusercontent.com/u/23506699?v=4","gravatar_id":"","url":"https://api.github.com/users/quintilesims","html_url":"https://github.com/quintilesims","followers_url":"https://api.github.com/users/quintilesims/followers","following_url":"https://api.github.com/users/quintilesims/following{/other_user}","gists_url":"https://api.github.com/users/quintilesims/gists{/gist_id}","starred_url":"https://api.github.com/users/quintilesims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quintilesims/subscriptions","organizations_url":"https://api.github.com/users/quintilesims/orgs","repos_url":"https://api.github.com/users/quintilesims/repos","events_url":"https://api.github.com/users/quintilesims/events{/privacy}","received_events_url":"https://api.github.com/users/quintilesims/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/quintilesims/layer0","description":"Build, Manage, and Deploy Your Applications","fork":false,"url":"https://api.github.com/repos/quintilesims/layer0","forks_url":"https://api.github.com/repos/quintilesims/layer0/forks","keys_url":"https://api.github.com/repos/quintilesims/layer0/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quintilesims/layer0/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quintilesims/layer0/teams","hooks_url":"https://api.github.com/repos/quintilesims/layer0/hooks","issue_events_url":"https://api.github.com/repos/quintilesims/layer0/issues/events{/number}","events_url":"https://api.github.com/repos/quintilesims/layer0/events","assignees_url":"https://api.github.com/repos/quintilesims/layer0/assignees{/user}","branches_url":"https://api.github.com/repos/quintilesims/layer0/branches{/branch}","tags_url":"https://api.github.com/repos/quintilesims/layer0/tags","blobs_url":"https://api.github.com/repos/quintilesims/layer0/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quintilesims/layer0/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quintilesims/layer0/git/refs{/sha}","trees_url":"https://api.github.com/repos/quintilesims/layer0/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quintilesims/layer0/statuses/{sha}","languages_url":"https://api.github.com/repos/quintilesims/layer0/languages","stargazers_url":"https://api.github.com/repos/quintilesims/layer0/stargazers","contributors_url":"https://api.github.com/repos/quintilesims/layer0/contributors","subscribers_url":"https://api.github.com/repos/quintilesims/layer0/subscribers","subscription_url":"https://api.github.com/repos/quintilesims/layer0/subscription","commits_url":"https://api.github.com/repos/quintilesims/layer0/commits{/sha}","git_commits_url":"https://api.github.com/repos/quintilesims/layer0/git/commits{/sha}","comments_url":"https://api.github.com/repos/quintilesims/layer0/comments{/number}","issue_comment_url":"https://api.github.com/repos/quintilesims/layer0/issues/comments{/number}","contents_url":"https://api.github.com/repos/quintilesims/layer0/contents/{+path}","compare_url":"https://api.github.com/repos/quintilesims/layer0/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quintilesims/layer0/merges","archive_url":"https://api.github.com/repos/quintilesims/layer0/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quintilesims/layer0/downloads","issues_url":"https://api.github.com/repos/quintilesims/layer0/issues{/number}","pulls_url":"https://api.github.com/repos/quintilesims/layer0/pulls{/number}","milestones_url":"https://api.github.com/repos/quintilesims/layer0/milestones{/number}","notifications_url":"https://api.github.com/repos/quintilesims/layer0/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quintilesims/layer0/labels{/name}","releases_url":"https://api.github.com/repos/quintilesims/layer0/releases{/id}","deployments_url":"https://api.github.com/repos/quintilesims/layer0/deployments","created_at":"2016-11-18T21:18:34Z","updated_at":"2017-10-17T19:54:24Z","pushed_at":"2017-10-19T22:31:55Z","git_url":"git://github.com/quintilesims/layer0.git","ssh_url":"git@github.com:quintilesims/layer0.git","clone_url":"https://github.com/quintilesims/layer0.git","svn_url":"https://github.com/quintilesims/layer0","homepage":"","size":51454,"stargazers_count":23,"watchers_count":23,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":38,"forks":2,"open_issues":38,"watchers":23,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/quintilesims/layer0/pulls/387"},"html":{"href":"https://github.com/quintilesims/layer0/pull/387"},"issue":{"href":"https://api.github.com/repos/quintilesims/layer0/issues/387"},"comments":{"href":"https://api.github.com/repos/quintilesims/layer0/issues/387/comments"},"review_comments":{"href":"https://api.github.com/repos/quintilesims/layer0/pulls/387/comments"},"review_comment":{"href":"https://api.github.com/repos/quintilesims/layer0/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quintilesims/layer0/pulls/387/commits"},"statuses":{"href":"https://api.github.com/repos/quintilesims/layer0/statuses/27f72a1219ad8d676e379f1ff722a8325838f724"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"zpatrick"}}