Merge PR #5655: Fix TestParseHTTPArgs

This commit is contained in:
Alexander Bezobchuk 2020-02-17 14:46:48 +01:00 committed by GitHub
parent 235aa6c091
commit 9b3296be79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {