From 0cb99be988446f6da6d90cb5d63a6e1c116ef76f Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Mon, 27 Apr 2015 13:20:03 -0700 Subject: [PATCH] Log expected and result of SignBytes tests, drone.io is failing --- types/tx_test.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/types/tx_test.go b/types/tx_test.go index aa66e311..5ad6ace9 100644 --- a/types/tx_test.go +++ b/types/tx_test.go @@ -4,6 +4,8 @@ import ( "testing" "github.com/tendermint/tendermint/account" + . "github.com/tendermint/tendermint/common" + "github.com/tendermint/tendermint/config" ) func TestSendTxSignable(t *testing.T) { @@ -33,9 +35,10 @@ func TestSendTxSignable(t *testing.T) { } signBytes := account.SignBytes(sendTx) signStr := string(signBytes) - expected := `{"Network":"74656E6465726D696E745F746573746E657433","Tx":[1,{"Inputs":[{"Address":"696E70757431","Amount":12345,"Sequence":67890},{"Address":"696E70757432","Amount":111,"Sequence":222}],"Outputs":[{"Address":"6F757470757431","Amount":333},{"Address":"6F757470757432","Amount":444}]}]}` + expected := Fmt(`{"Network":"%X","Tx":[1,{"Inputs":[{"Address":"696E70757431","Amount":12345,"Sequence":67890},{"Address":"696E70757432","Amount":111,"Sequence":222}],"Outputs":[{"Address":"6F757470757431","Amount":333},{"Address":"6F757470757432","Amount":444}]}]}`, + config.App().GetString("Network")) if signStr != expected { - t.Errorf("Got unexpected sign string for SendTx") + t.Errorf("Got unexpected sign string for SendTx. Expected:\n%v\nGot:\n%v", expected, signStr) } } @@ -53,9 +56,10 @@ func TestCallTxSignable(t *testing.T) { } signBytes := account.SignBytes(callTx) signStr := string(signBytes) - expected := `{"Network":"74656E6465726D696E745F746573746E657433","Tx":[2,{"Address":"636F6E747261637431","Data":"6461746131","Fee":222,"GasLimit":111,"Input":{"Address":"696E70757431","Amount":12345,"Sequence":67890}}]}` + expected := Fmt(`{"Network":"%X","Tx":[2,{"Address":"636F6E747261637431","Data":"6461746131","Fee":222,"GasLimit":111,"Input":{"Address":"696E70757431","Amount":12345,"Sequence":67890}}]}`, + config.App().GetString("Network")) if signStr != expected { - t.Errorf("Got unexpected sign string for CallTx") + t.Errorf("Got unexpected sign string for CallTx. Expected:\n%v\nGot:\n%v", expected, signStr) } } @@ -88,7 +92,8 @@ func TestBondTxSignable(t *testing.T) { } signBytes := account.SignBytes(bondTx) signStr := string(signBytes) - expected := `{"Network":"74656E6465726D696E745F746573746E657433","Tx":[17,{"Inputs":[{"Address":"696E70757431","Amount":12345,"Sequence":67890},{"Address":"696E70757432","Amount":111,"Sequence":222}],"PubKey":[1,"3B6A27BCCEB6A42D62A3A8D02A6F0D73653215771DE243A63AC048A18B59DA29"],"UnbondTo":[{"Address":"6F757470757431","Amount":333},{"Address":"6F757470757432","Amount":444}]}]}` + expected := Fmt(`{"Network":"%X","Tx":[17,{"Inputs":[{"Address":"696E70757431","Amount":12345,"Sequence":67890},{"Address":"696E70757432","Amount":111,"Sequence":222}],"PubKey":[1,"3B6A27BCCEB6A42D62A3A8D02A6F0D73653215771DE243A63AC048A18B59DA29"],"UnbondTo":[{"Address":"6F757470757431","Amount":333},{"Address":"6F757470757432","Amount":444}]}]}`, + config.App().GetString("Network")) if signStr != expected { t.Errorf("Got unexpected sign string for BondTx") } @@ -101,7 +106,8 @@ func TestUnbondTxSignable(t *testing.T) { } signBytes := account.SignBytes(unbondTx) signStr := string(signBytes) - expected := `{"Network":"74656E6465726D696E745F746573746E657433","Tx":[18,{"Address":"6164647265737331","Height":111}]}` + expected := Fmt(`{"Network":"%X","Tx":[18,{"Address":"6164647265737331","Height":111}]}`, + config.App().GetString("Network")) if signStr != expected { t.Errorf("Got unexpected sign string for UnbondTx") } @@ -114,7 +120,8 @@ func TestRebondTxSignable(t *testing.T) { } signBytes := account.SignBytes(rebondTx) signStr := string(signBytes) - expected := `{"Network":"74656E6465726D696E745F746573746E657433","Tx":[19,{"Address":"6164647265737331","Height":111}]}` + expected := Fmt(`{"Network":"%X","Tx":[19,{"Address":"6164647265737331","Height":111}]}`, + config.App().GetString("Network")) if signStr != expected { t.Errorf("Got unexpected sign string for RebondTx") }