Remove Uptime.Last* parameters
This commit is contained in:
@ -2,11 +2,10 @@ package paging
|
||||
|
||||
// ServiceStatusParams represents all parameters that can be used for paging purposes
|
||||
type ServiceStatusParams struct {
|
||||
EventsPage int // Number of the event page
|
||||
EventsPageSize int // Size of the event page
|
||||
ResultsPage int // Number of the result page
|
||||
ResultsPageSize int // Size of the result page
|
||||
IncludeUptime bool // Whether to include uptime data
|
||||
EventsPage int // Number of the event page
|
||||
EventsPageSize int // Size of the event page
|
||||
ResultsPage int // Number of the result page
|
||||
ResultsPageSize int // Size of the result page
|
||||
}
|
||||
|
||||
// NewServiceStatusParams creates a new ServiceStatusParams
|
||||
@ -27,9 +26,3 @@ func (params *ServiceStatusParams) WithResults(page, pageSize int) *ServiceStatu
|
||||
params.ResultsPageSize = pageSize
|
||||
return params
|
||||
}
|
||||
|
||||
// WithUptime sets the value IncludeUptime to true
|
||||
func (params *ServiceStatusParams) WithUptime() *ServiceStatusParams {
|
||||
params.IncludeUptime = true
|
||||
return params
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ func TestNewServiceStatusParams(t *testing.T) {
|
||||
ExpectedEventsPageSize int
|
||||
ExpectedResultsPage int
|
||||
ExpectedResultsPageSize int
|
||||
ExpectedIncludeUptime bool
|
||||
}
|
||||
scenarios := []Scenario{
|
||||
{
|
||||
@ -20,7 +19,6 @@ func TestNewServiceStatusParams(t *testing.T) {
|
||||
ExpectedEventsPageSize: 0,
|
||||
ExpectedResultsPage: 0,
|
||||
ExpectedResultsPageSize: 0,
|
||||
ExpectedIncludeUptime: false,
|
||||
},
|
||||
{
|
||||
Name: "with-events-page-2-size-7",
|
||||
@ -29,25 +27,22 @@ func TestNewServiceStatusParams(t *testing.T) {
|
||||
ExpectedEventsPageSize: 7,
|
||||
ExpectedResultsPage: 0,
|
||||
ExpectedResultsPageSize: 0,
|
||||
ExpectedIncludeUptime: false,
|
||||
},
|
||||
{
|
||||
Name: "with-events-page-4-size-3-uptime",
|
||||
Params: NewServiceStatusParams().WithEvents(4, 3).WithUptime(),
|
||||
Params: NewServiceStatusParams().WithEvents(4, 3),
|
||||
ExpectedEventsPage: 4,
|
||||
ExpectedEventsPageSize: 3,
|
||||
ExpectedResultsPage: 0,
|
||||
ExpectedResultsPageSize: 0,
|
||||
ExpectedIncludeUptime: true,
|
||||
},
|
||||
{
|
||||
Name: "with-results-page-1-size-20-uptime",
|
||||
Params: NewServiceStatusParams().WithResults(1, 20).WithUptime(),
|
||||
Params: NewServiceStatusParams().WithResults(1, 20),
|
||||
ExpectedEventsPage: 0,
|
||||
ExpectedEventsPageSize: 0,
|
||||
ExpectedResultsPage: 1,
|
||||
ExpectedResultsPageSize: 20,
|
||||
ExpectedIncludeUptime: true,
|
||||
},
|
||||
{
|
||||
Name: "with-results-page-2-size-10-events-page-3-size-50",
|
||||
@ -56,7 +51,6 @@ func TestNewServiceStatusParams(t *testing.T) {
|
||||
ExpectedEventsPageSize: 50,
|
||||
ExpectedResultsPage: 2,
|
||||
ExpectedResultsPageSize: 10,
|
||||
ExpectedIncludeUptime: false,
|
||||
},
|
||||
}
|
||||
for _, scenario := range scenarios {
|
||||
@ -73,9 +67,6 @@ func TestNewServiceStatusParams(t *testing.T) {
|
||||
if scenario.Params.ResultsPageSize != scenario.ExpectedResultsPageSize {
|
||||
t.Errorf("expected ResultsPageSize to be %d, was %d", scenario.ExpectedResultsPageSize, scenario.Params.ResultsPageSize)
|
||||
}
|
||||
if scenario.Params.IncludeUptime != scenario.ExpectedIncludeUptime {
|
||||
t.Errorf("expected IncludeUptime to be %v, was %v", scenario.ExpectedIncludeUptime, scenario.Params.IncludeUptime)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user