Merge PR #5655: Fix TestParseHTTPArgs
This commit is contained in:
parent
235aa6c091
commit
9b3296be79
@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -91,12 +92,15 @@ func TestParseHTTPArgs(t *testing.T) {
|
||||
{"error limit 0", reqE2, httptest.NewRecorder(), []string{}, DefaultPage, DefaultLimit, true},
|
||||
|
||||
{"tags", req4, httptest.NewRecorder(), []string{"foo='faa'"}, DefaultPage, DefaultLimit, false},
|
||||
{"tags", reqTxH, httptest.NewRecorder(), []string{"tx.height>=12", "tx.height<=14"}, DefaultPage, DefaultLimit, false},
|
||||
{"tags", reqTxH, httptest.NewRecorder(), []string{"tx.height<=14", "tx.height>=12"}, DefaultPage, DefaultLimit, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tags, page, limit, err := ParseHTTPArgs(tt.req)
|
||||
|
||||
sort.Strings(tags)
|
||||
|
||||
if tt.err {
|
||||
require.NotNil(t, err)
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user