Move lcd tests into gaia (#4245)
Objective is to remove lcd -> gaia package dep. Code cleanup.
This commit is contained in:
parent
466e46ba0a
commit
4d6480aa46
|
@ -1,12 +0,0 @@
|
|||
package lcd
|
||||
|
||||
import (
|
||||
amino "github.com/tendermint/go-amino"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
||||
var cdc = amino.NewCodec()
|
||||
|
||||
func init() {
|
||||
ctypes.RegisterAmino(cdc)
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package lcd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -106,16 +105,3 @@ func (rs *RestServer) registerSwaggerUI() {
|
|||
staticServer := http.FileServer(statikFS)
|
||||
rs.Mux.PathPrefix("/swagger-ui/").Handler(http.StripPrefix("/swagger-ui/", staticServer))
|
||||
}
|
||||
|
||||
func validateCertKeyFiles(certFile, keyFile string) error {
|
||||
if keyFile == "" {
|
||||
return errors.New("a key file is required")
|
||||
}
|
||||
if _, err := os.Stat(certFile); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(keyFile); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lcd
|
||||
package lcd_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -16,9 +16,11 @@ import (
|
|||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/go-amino"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
clientkeys "github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/client/lcd"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/x/params"
|
||||
|
@ -67,6 +69,12 @@ import (
|
|||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
var cdc = amino.NewCodec()
|
||||
|
||||
func init() {
|
||||
ctypes.RegisterAmino(cdc)
|
||||
}
|
||||
|
||||
// makePathname creates a unique pathname for each test. It will panic if it
|
||||
// cannot get the current working directory.
|
||||
func makePathname() string {
|
||||
|
@ -394,7 +402,7 @@ func startTM(
|
|||
|
||||
// startLCD starts the LCD.
|
||||
func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec, t *testing.T) (net.Listener, error) {
|
||||
rs := NewRestServer(cdc)
|
||||
rs := lcd.NewRestServer(cdc)
|
||||
registerRoutes(rs)
|
||||
listener, err := tmrpc.Listen(listenAddr, tmrpc.DefaultConfig())
|
||||
if err != nil {
|
||||
|
@ -405,7 +413,7 @@ func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec, t *testing
|
|||
}
|
||||
|
||||
// NOTE: If making updates here also update cmd/gaia/cmd/gaiacli/main.go
|
||||
func registerRoutes(rs *RestServer) {
|
||||
func registerRoutes(rs *lcd.RestServer) {
|
||||
rpc.RegisterRoutes(rs.CliCtx, rs.Mux)
|
||||
tx.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc)
|
||||
authrest.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc, auth.StoreKey)
|
|
@ -1,4 +1,4 @@
|
|||
package lcd
|
||||
package lcd_test
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
@ -36,11 +36,8 @@ import (
|
|||
|
||||
const (
|
||||
name1 = "test1"
|
||||
name2 = "test2"
|
||||
name3 = "test3"
|
||||
memo = "LCD test tx"
|
||||
pw = client.DefaultKeyPass
|
||||
altPw = "12345678901"
|
||||
)
|
||||
|
||||
var fees = sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}
|
Loading…
Reference in New Issue