Skip to content

Commit

Permalink
refactor: refactor IntervalAction test to use factory method
Browse files Browse the repository at this point in the history
Close #535

Signed-off-by: weichou <weichou1229@gmail.com>
  • Loading branch information
weichou1229 committed Mar 9, 2021
1 parent 81d8f1f commit 05a181e
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions v2/dtos/requests/intervalaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,9 @@ import (
)

func addIntervalActionRequestData() AddIntervalActionRequest {
return AddIntervalActionRequest{
BaseRequest: common.BaseRequest{
RequestId: ExampleUUID,
Versionable: common.NewVersionable(),
},
Action: dtos.IntervalAction{
Versionable: common.NewVersionable(),
Name: TestIntervalActionName,
IntervalName: TestIntervalName,
Address: dtos.Address{
Type: v2.REST,
Host: TestHost,
Port: TestPort,
RESTAddress: dtos.RESTAddress{HTTPMethod: TestHTTPMethod},
},
},
}
address := dtos.NewRESTAddress(TestHost, TestPort, TestHTTPMethod)
dto := dtos.NewIntervalAction(TestIntervalActionName, TestIntervalName, address)
return NewAddIntervalActionRequest(dto)
}

func updateIntervalActionRequestData() UpdateIntervalActionRequest {
Expand All @@ -58,12 +44,8 @@ func updateIntervalActionData() dtos.UpdateIntervalAction {
dto.Id = &testId
dto.Name = &testName
dto.IntervalName = &testIntervalName
dto.Address = &dtos.Address{
Type: v2.REST,
Host: TestHost,
Port: TestPort,
RESTAddress: dtos.RESTAddress{HTTPMethod: TestHTTPMethod},
}
address := dtos.NewRESTAddress(TestHost, TestPort, TestHTTPMethod)
dto.Address = &address
return dto
}

Expand Down

0 comments on commit 05a181e

Please sign in to comment.