@@ -13,7 +13,7 @@ func TestCreateWebhookAction(t *testing.T) {
13
13
// Arrange
14
14
testRequest := autopilot .NewTestRequest (
15
15
`mutation WebhookActionCreate($input:CustomActionsWebhookActionCreateInput!){customActionsWebhookActionCreate(input: $input){webhookAction{{ template "custom_actions_request" }},errors{message,path}}}` ,
16
- `{"input":{"headers":"{\"Content-Type\":\"application/json\"}","httpMethod":"POST",{{ template "liquid_template_rollback" }},"name":"Deploy Rollback","webhookUrl":"https://gitlab.com/api/v4/projects/1/trigger/pipeline"}}` ,
16
+ `{"input":{"headers":[ "{\"Content-Type\":\"application/json\"}"] ,"httpMethod":"POST",{{ template "liquid_template_rollback" }},"name":"Deploy Rollback","webhookUrl":"https://gitlab.com/api/v4/projects/1/trigger/pipeline"}}` ,
17
17
`{"data": {"customActionsWebhookActionCreate": { "webhookAction": {{ template "custom_action1" }}, "errors": [] }}}` ,
18
18
)
19
19
@@ -23,11 +23,9 @@ func TestCreateWebhookAction(t *testing.T) {
23
23
action , err := client .CreateWebhookAction (ol.CustomActionsWebhookActionCreateInput {
24
24
Name : "Deploy Rollback" ,
25
25
LiquidTemplate : ol .NewString ("{\" token\" : \" XXX\" , \" ref\" :\" main\" , \" action\" : \" rollback\" }" ),
26
- Headers : ol.JSON {
27
- "Content-Type" : "application/json" ,
28
- },
29
- HTTPMethod : ol .CustomActionsHttpMethodEnumPost ,
30
- WebhookURL : "https://gitlab.com/api/v4/projects/1/trigger/pipeline" ,
26
+ Headers : & []ol.JSON {{"Content-Type" : "application/json" }},
27
+ HttpMethod : ol .CustomActionsHttpMethodEnumPost ,
28
+ WebhookUrl : "https://gitlab.com/api/v4/projects/1/trigger/pipeline" ,
31
29
})
32
30
33
31
// Assert
@@ -73,7 +71,7 @@ func TestUpdateWebhookAction(t *testing.T) {
73
71
// Act
74
72
action , err := client .UpdateWebhookAction (ol.CustomActionsWebhookActionUpdateInput {
75
73
Id : * newID ,
76
- HTTPMethod : ol .CustomActionsHttpMethodEnumPut ,
74
+ HttpMethod : ol.NewEnum [ol. CustomActionsHttpMethodEnum ]( ol . CustomActionsHttpMethodEnumPut ) ,
77
75
})
78
76
79
77
// Assert
@@ -85,7 +83,7 @@ func TestUpdateWebhookAction2(t *testing.T) {
85
83
// Arrange
86
84
testRequest := autopilot .NewTestRequest (
87
85
`mutation WebhookActionUpdate($input:CustomActionsWebhookActionUpdateInput!){customActionsWebhookActionUpdate(input: $input){webhookAction{{ template "custom_actions_request" }},errors{message,path}}}` ,
88
- `{"input":{"id": "123456789","description":"","headers":"{\"Accept\":\"application/json\"}"}}` ,
86
+ `{"input":{"id": "123456789","description":"","headers":[ "{\"Accept\":\"application/json\"}"] }}` ,
89
87
`{"data": {"customActionsWebhookActionUpdate": { "webhookAction": {{ template "custom_action1" }}, "errors": [] }}}` ,
90
88
)
91
89
@@ -98,7 +96,7 @@ func TestUpdateWebhookAction2(t *testing.T) {
98
96
action , err := client .UpdateWebhookAction (ol.CustomActionsWebhookActionUpdateInput {
99
97
Id : * newID ,
100
98
Description : ol .NewString ("" ),
101
- Headers : & headers ,
99
+ Headers : & []ol. JSON { headers } ,
102
100
})
103
101
104
102
// Assert
@@ -134,11 +132,14 @@ func TestCreateTriggerDefinition(t *testing.T) {
134
132
135
133
// Act
136
134
trigger , err := client .CreateTriggerDefinition (ol.CustomActionsTriggerDefinitionCreateInput {
137
- Name : "Deploy Rollback" ,
138
- Description : ol .NewString ("Disables the Deploy Freeze" ),
139
- Action : * newID ,
140
- Owner : * newID ,
141
- Filter : ol .NewID ("987654321" ),
135
+ Name : "Deploy Rollback" ,
136
+ AccessControl : ol.NewEnum [ol.CustomActionsTriggerDefinitionAccessControlEnum ](ol .CustomActionsTriggerDefinitionAccessControlEnumEveryone ),
137
+ Description : ol .NewString ("Disables the Deploy Freeze" ),
138
+ ResponseTemplate : ol .NewString ("" ),
139
+ ManualInputsDefinition : ol .NewString ("" ),
140
+ ActionId : newID ,
141
+ OwnerId : * newID ,
142
+ FilterId : ol .NewID ("987654321" ),
142
143
})
143
144
// Assert
144
145
autopilot .Ok (t , err )
@@ -156,12 +157,15 @@ func TestCreateTriggerDefinitionWithGlobalEntityType(t *testing.T) {
156
157
157
158
// Act
158
159
trigger , err := client .CreateTriggerDefinition (ol.CustomActionsTriggerDefinitionCreateInput {
159
- Name : "Deploy Rollback" ,
160
- Description : ol .NewString ("Disables the Deploy Freeze" ),
161
- Action : * newID ,
162
- Owner : * newID ,
163
- Filter : ol .NewID ("987654321" ),
164
- EntityType : "GLOBAL" ,
160
+ Name : "Deploy Rollback" ,
161
+ AccessControl : ol.NewEnum [ol.CustomActionsTriggerDefinitionAccessControlEnum ](ol .CustomActionsTriggerDefinitionAccessControlEnumEveryone ),
162
+ Description : ol .NewString ("Disables the Deploy Freeze" ),
163
+ ActionId : newID ,
164
+ ManualInputsDefinition : ol .NewString ("" ),
165
+ ResponseTemplate : ol .NewString ("" ),
166
+ OwnerId : * newID ,
167
+ FilterId : ol .NewID ("987654321" ),
168
+ EntityType : ol.NewEnum [ol.CustomActionsEntityTypeEnum ](ol .CustomActionsEntityTypeEnumGlobal ),
165
169
ExtendedTeamAccess : & []ol.IdentifierInput {
166
170
* ol .NewIdentifier ("example_1" ),
167
171
* ol .NewIdentifier ("example_1" ),
@@ -183,12 +187,15 @@ func TestCreateTriggerDefinitionWithNullExtendedTeams(t *testing.T) {
183
187
client := BestTestClient (t , "custom_actions/create_trigger_with_null_extended_teams" , testRequest )
184
188
// Act
185
189
trigger , err := client .CreateTriggerDefinition (ol.CustomActionsTriggerDefinitionCreateInput {
186
- Name : "Deploy Rollback" ,
187
- Description : ol .NewString ("Disables the Deploy Freeze" ),
188
- Action : * newID ,
189
- Owner : * newID ,
190
- Filter : ol .NewID ("987654321" ),
191
- ExtendedTeamAccess : & []ol.IdentifierInput {},
190
+ Name : "Deploy Rollback" ,
191
+ Description : ol .NewString ("Disables the Deploy Freeze" ),
192
+ AccessControl : ol.NewEnum [ol.CustomActionsTriggerDefinitionAccessControlEnum ](ol .CustomActionsTriggerDefinitionAccessControlEnumEveryone ),
193
+ ManualInputsDefinition : ol .NewString ("" ),
194
+ ResponseTemplate : ol .NewString ("" ),
195
+ ActionId : newID ,
196
+ OwnerId : * newID ,
197
+ FilterId : ol .NewID ("987654321" ),
198
+ ExtendedTeamAccess : & []ol.IdentifierInput {},
192
199
})
193
200
// Assert
194
201
autopilot .Ok (t , err )
@@ -253,8 +260,8 @@ func TestUpdateTriggerDefinition(t *testing.T) {
253
260
254
261
// Act
255
262
trigger , err := client .UpdateTriggerDefinition (ol.CustomActionsTriggerDefinitionUpdateInput {
256
- Id : * newID ,
257
- Filter : ol .NewID (),
263
+ Id : * newID ,
264
+ FilterId : ol .NewID (),
258
265
})
259
266
// Assert
260
267
autopilot .Ok (t , err )
0 commit comments