Test GetMeasurements fails on invalid offset value provided
parent
786d345ee2
commit
55e8f5cbd8
|
@ -382,24 +382,6 @@ func TestService_Measurements(t *testing.T) {
|
|||
}, nil
|
||||
},
|
||||
},
|
||||
Databases: &mocks.Databases{
|
||||
ConnectF: func(context.Context, *chronograf.Source) error {
|
||||
return nil
|
||||
},
|
||||
GetMeasurementsF: func(ctx context.Context, dbID string, limit, offset int) ([]chronograf.Measurement, error) {
|
||||
return []chronograf.Measurement{
|
||||
{
|
||||
Name: "pineapple",
|
||||
},
|
||||
{
|
||||
Name: "cubeapple",
|
||||
},
|
||||
{
|
||||
Name: "pinecube",
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
queryParams: map[string]string{
|
||||
|
@ -411,6 +393,27 @@ func TestService_Measurements(t *testing.T) {
|
|||
body: `{"code":422,"message":"strconv.Atoi: parsing \"joe\": invalid syntax"}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Fails when invalid offset value provided",
|
||||
fields: fields{
|
||||
SourcesStore: &mocks.SourcesStore{
|
||||
GetF: func(ctx context.Context, srcID int) (chronograf.Source, error) {
|
||||
return chronograf.Source{
|
||||
ID: 0,
|
||||
}, nil
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
queryParams: map[string]string{
|
||||
"offset": "bob",
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
statusCode: 422,
|
||||
body: `{"code":422,"message":"strconv.Atoi: parsing \"bob\": invalid syntax"}`,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue