You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
828 B

7 years ago
  1. package core_grpc_test
  2. import (
  3. "os"
  4. "testing"
  5. "github.com/stretchr/testify/require"
  6. "golang.org/x/net/context"
  7. "github.com/tendermint/abci/example/dummy"
  8. "github.com/tendermint/tendermint/rpc/grpc"
  9. "github.com/tendermint/tendermint/rpc/test"
  10. )
  11. func TestMain(m *testing.M) {
  12. // start a tendermint node in the background to test against
  13. app := dummy.NewDummyApplication()
  14. node := rpctest.StartTendermint(app)
  15. code := m.Run()
  16. // and shut down proper at the end
  17. node.Stop()
  18. node.Wait()
  19. os.Exit(code)
  20. }
  21. func TestBroadcastTx(t *testing.T) {
  22. require := require.New(t)
  23. res, err := rpctest.GetGRPCClient().BroadcastTx(context.Background(), &core_grpc.RequestBroadcastTx{[]byte("this is a tx")})
  24. require.Nil(err, "%+v", err)
  25. require.EqualValues(0, res.CheckTx.Code)
  26. require.EqualValues(0, res.DeliverTx.Code)
  27. }