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.

29 lines
827 B

10 years ago
10 years ago
10 years ago
  1. package types
  2. import (
  3. "testing"
  4. . "github.com/tendermint/go-common"
  5. "github.com/tendermint/tendermint/config/tendermint_test"
  6. )
  7. func init() {
  8. tendermint_test.ResetConfig("types_proposal_test")
  9. }
  10. func TestProposalSignable(t *testing.T) {
  11. proposal := &Proposal{
  12. Height: 12345,
  13. Round: 23456,
  14. BlockPartsHeader: PartSetHeader{111, []byte("blockparts")},
  15. POLRound: -1,
  16. }
  17. signBytes := SignBytes(config.GetString("chain_id"), proposal)
  18. signStr := string(signBytes)
  19. expected := Fmt(`{"chain_id":"%s","proposal":{"block_parts_header":{"hash":"626C6F636B7061727473","total":111},"height":12345,"pol_round":-1,"round":23456}}`,
  20. config.GetString("chain_id"))
  21. if signStr != expected {
  22. t.Errorf("Got unexpected sign string for SendTx. Expected:\n%v\nGot:\n%v", expected, signStr)
  23. }
  24. }