cosmos-sdk/tests/systemtests/rest_cli.go
2024-10-01 08:16:04 +00:00

30 lines
582 B
Go

package systemtests
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/testutil"
)
type GRPCTestCase struct {
name string
url string
expOut string
}
// RunGRPCQueries runs given grpc testcases by making requests and
// checking response with expected output
func RunGRPCQueries(t *testing.T, testCases []GRPCTestCase) {
t.Helper()
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
resp, err := testutil.GetRequest(tc.url)
require.NoError(t, err)
require.JSONEq(t, tc.expOut, string(resp))
})
}
}