@@ -1194,3 +1194,37 @@ func TestApplicationService_CreateDockerImage(t *testing.T) {
11941194 assert .NotNil (t , result )
11951195 assert .Equal (t , "new-app-uuid" , result .UUID )
11961196}
1197+
1198+ func TestApplicationService_BulkUpdateEnvs (t * testing.T ) {
1199+ server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
1200+ assert .Equal (t , "/api/v1/applications/app-uuid-123/envs/bulk" , r .URL .Path )
1201+ assert .Equal (t , "PATCH" , r .Method )
1202+ assert .Equal (t , "Bearer test-token" , r .Header .Get ("Authorization" ))
1203+
1204+ // Return array response as per API
1205+ w .Header ().Set ("Content-Type" , "application/json" )
1206+ resp := []models.EnvironmentVariable {
1207+ {
1208+ Key : "KEY1" ,
1209+ Value : "VAL1" ,
1210+ },
1211+ }
1212+ _ = json .NewEncoder (w ).Encode (resp )
1213+ }))
1214+ defer server .Close ()
1215+
1216+ client := api .NewClient (server .URL , "test-token" )
1217+ svc := NewApplicationService (client )
1218+
1219+ req := & BulkUpdateEnvsRequest {
1220+ Data : []models.EnvironmentVariableCreateRequest {
1221+ {Key : "KEY1" , Value : "VAL1" },
1222+ },
1223+ }
1224+
1225+ result , err := svc .BulkUpdateEnvs (context .Background (), "app-uuid-123" , req )
1226+ require .NoError (t , err )
1227+ assert .NotNil (t , result )
1228+ assert .Len (t , * result , 1 )
1229+ assert .Equal (t , "KEY1" , (* result )[0 ].Key )
1230+ }
0 commit comments