@@ -228,6 +228,9 @@ func TestTemplateEdit(t *testing.T) {
228
228
"templates" ,
229
229
"edit" ,
230
230
template .Name ,
231
+ "--description" , "" ,
232
+ "--display-name" , "" ,
233
+ "--icon" , "" ,
231
234
}
232
235
inv , root := clitest .New (t , cmdArgs ... )
233
236
clitest .SetupConfig (t , templateAdmin , root )
@@ -1047,4 +1050,41 @@ func TestTemplateEdit(t *testing.T) {
1047
1050
require .Error (t , err )
1048
1051
require .ErrorContains (t , err , "appears to be an AGPL deployment" )
1049
1052
})
1053
+ t .Run ("DefaultValues" , func (t * testing.T ) {
1054
+ t .Parallel ()
1055
+ client := coderdtest .New (t , & coderdtest.Options {IncludeProvisionerDaemon : true })
1056
+ owner := coderdtest .CreateFirstUser (t , client )
1057
+
1058
+ version := coderdtest .CreateTemplateVersion (t , client , owner .OrganizationID , nil )
1059
+ _ = coderdtest .AwaitTemplateVersionJobCompleted (t , client , version .ID )
1060
+ template := coderdtest .CreateTemplate (t , client , owner .OrganizationID , version .ID , func (ctr * codersdk.CreateTemplateRequest ) {
1061
+ ctr .Name = "random"
1062
+ ctr .Icon = "/icon/foobar.png"
1063
+ ctr .DisplayName = "Foobar"
1064
+ ctr .Description = "Some description"
1065
+ })
1066
+
1067
+ // We need to change some field to get a db write.
1068
+ cmdArgs := []string {
1069
+ "templates" ,
1070
+ "edit" ,
1071
+ template .Name ,
1072
+ "--name" , "something-new" ,
1073
+ }
1074
+ inv , root := clitest .New (t , cmdArgs ... )
1075
+ //nolint
1076
+ clitest .SetupConfig (t , client , root )
1077
+
1078
+ ctx := testutil .Context (t , testutil .WaitLong )
1079
+ err := inv .WithContext (ctx ).Run ()
1080
+ require .NoError (t , err )
1081
+
1082
+ updated , err := client .Template (context .Background (), template .ID )
1083
+ require .NoError (t , err )
1084
+ assert .Equal (t , "something-new" , updated .Name )
1085
+ assert .Equal (t , template .Icon , updated .Icon )
1086
+ assert .Equal (t , template .DisplayName , updated .DisplayName )
1087
+ assert .Equal (t , template .Description , updated .Description )
1088
+ assert .Equal (t , template .DeprecationMessage , updated .DeprecationMessage )
1089
+ })
1050
1090
}
0 commit comments