Skip to content

Commit 9a5b3c0

Browse files
committed
refactor(ufw):
- fixed create rules tests
1 parent 30151c5 commit 9a5b3c0

1 file changed

Lines changed: 9 additions & 30 deletions

File tree

internal/cmd/ufw/rules/create/create_test.go

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
4040
typeFlag: testType,
4141
sourceIpFlag: testSourceIp,
4242
instanceIdFlag: testInstanceId,
43-
directionFlag: "ingress",
44-
descriptionFlag: "example-description",
45-
etherTypeFlag: "IPv4",
46-
portRangeFlag: "80-443",
47-
protocolFlag: "TCP",
48-
offsetFlag: "10",
49-
securityGroupIdFlag: "example-sec-group",
5043
}
5144
for _, mod := range mods {
5245
mod(flagValues)
@@ -61,17 +54,10 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6154
Region: testRegion,
6255
Verbosity: globalflags.VerbosityDefault,
6356
},
64-
Product: new(testProduct),
65-
Type: new(testType),
66-
SourceIp: new(testSourceIp),
67-
InstanceId: new(testInstanceId),
68-
Direction: new("ingress"),
69-
Description: new("example-description"),
70-
EtherType: new("IPv4"),
71-
PortRange: new("80-443"),
72-
Protocol: new("TCP"),
73-
Offset: new(int32(10)),
74-
SecurityGroupId: new("example-sec-group"),
57+
Product: new(testProduct),
58+
Type: new(testType),
59+
SourceIp: new(testSourceIp),
60+
InstanceId: new(testInstanceId),
7561
}
7662
for _, mod := range mods {
7763
mod(model)
@@ -82,17 +68,10 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
8268
func fixtureRequest(mods ...func(request *ufw.ApiCreateRuleRequest)) ufw.ApiCreateRuleRequest {
8369
request := testClient.DefaultAPI.CreateRule(testCtx, testProjectId, testRegion)
8470
request = request.CreateRulePayload(ufw.CreateRulePayload{
85-
Product: testProduct,
86-
Type: testType,
87-
SourceIP: testSourceIp,
88-
InstanceId: testInstanceId,
89-
Direction: new("ingress"),
90-
Description: new("example-description"),
91-
EtherType: new("IPv4"),
92-
PortRange: new("80-443"),
93-
Protocol: new("TCP"),
94-
Offset: new(int32(10)),
95-
SecurityGroupId: new("example-sec-group"),
71+
Product: testProduct,
72+
Type: testType,
73+
SourceIP: testSourceIp,
74+
InstanceId: testInstanceId,
9675
})
9776
for _, mod := range mods {
9877
mod(&request)
@@ -212,7 +191,7 @@ func TestBuildRequest(t *testing.T) {
212191
}),
213192
},
214193
{
215-
description: "required fields only, but wrong type",
194+
description: "required fields only but wrong type",
216195
model: &inputModel{
217196
GlobalFlagModel: &globalflags.GlobalFlagModel{
218197
ProjectId: testProjectId,

0 commit comments

Comments
 (0)