@@ -31,6 +31,7 @@ func TestTaskCreate(t *testing.T) {
31
31
templateID = uuid .New ()
32
32
templateVersionID = uuid .New ()
33
33
templateVersionPresetID = uuid .New ()
34
+ taskID = uuid .New ()
34
35
)
35
36
36
37
templateAndVersionFoundHandler := func (t * testing.T ,ctx context.Context ,orgID uuid.UUID ,templateName ,templateVersionName ,presetName ,prompt string ) http.HandlerFunc {
@@ -44,11 +45,11 @@ func TestTaskCreate(t *testing.T) {
44
45
ID :orgID ,
45
46
}},
46
47
})
47
- case fmt .Sprintf ("/api/v2/organizations/%s/templates/my-template /versions/my-template-version " ,orgID ):
48
+ case fmt .Sprintf ("/api/v2/organizations/%s/templates/%s /versions/%s " ,orgID , templateName , templateVersionName ):
48
49
httpapi .Write (ctx ,w ,http .StatusOK , codersdk.TemplateVersion {
49
50
ID :templateVersionID ,
50
51
})
51
- case fmt .Sprintf ("/api/v2/organizations/%s/templates/my-template " ,orgID ):
52
+ case fmt .Sprintf ("/api/v2/organizations/%s/templates/%s " ,orgID , templateName ):
52
53
httpapi .Write (ctx ,w ,http .StatusOK , codersdk.Template {
53
54
ID :templateID ,
54
55
ActiveVersionID :templateVersionID ,
@@ -83,7 +84,8 @@ func TestTaskCreate(t *testing.T) {
83
84
assert .Equal (t ,templateVersionPresetID ,req .TemplateVersionPresetID ,"template version preset id mismatch" )
84
85
}
85
86
86
- httpapi .Write (ctx ,w ,http .StatusCreated , codersdk.Workspace {
87
+ httpapi .Write (ctx ,w ,http .StatusCreated , codersdk.Task {
88
+ ID :taskID ,
87
89
Name :"task-wild-goldfish-27" ,
88
90
CreatedAt :taskCreatedAt ,
89
91
})
@@ -161,6 +163,13 @@ func TestTaskCreate(t *testing.T) {
161
163
return templateAndVersionFoundHandler (t ,ctx ,organizationID ,"my-template" ,"" ,"my-preset" ,"my custom prompt" )
162
164
},
163
165
},
166
+ {
167
+ args : []string {"my custom prompt" ,"-q" },
168
+ expectOutput :taskID .String (),
169
+ handler :func (t * testing.T ,ctx context.Context ) http.HandlerFunc {
170
+ return templateAndVersionFoundHandler (t ,ctx ,organizationID ,"my-template" ,"my-template-version" ,"" ,"my custom prompt" )
171
+ },
172
+ },
164
173
{
165
174
args : []string {"my custom prompt" ,"--template" ,"my-template" ,"--preset" ,"not-real-preset" },
166
175
expectError :`preset "not-real-preset" not found` ,