diff --git a/itests/alias_tx_api_test.go b/itests/alias_tx_api_test.go index 386862fa4..f2e8b5f62 100644 --- a/itests/alias_tx_api_test.go +++ b/itests/alias_tx_api_test.go @@ -23,13 +23,19 @@ func (suite *AliasTxApiSuite) Test_AliasTxApiPositive() { for _, v := range versions { tdmatrix := testdata.GetAliasPositiveDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { - tx, _, actualDiffBalanceInWaves := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { + tx, _, actualDiffBalanceInWaves := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, + td, v, waitForTx) + errMsg := caseName + "Broadcast Alias Tx: " + tx.TxID.String() + addrByAliasGo, addrByAliasScala := utl.GetAddressesByAlias(&suite.BaseSuite, td.Alias) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) + utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddress.Bytes(), addrByAliasGo, addrByAliasScala, + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) }) } } @@ -43,15 +49,19 @@ func (suite *AliasTxApiSuite) Test_AliasTxApiMaxValuesPositive() { utl.DefaultAccountForLoanFunds, 10000000000) tdmatrix := testdata.GetAliasMaxPositiveDataMatrix(&suite.BaseSuite, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, _, actualDiffBalanceInWaves := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Alias Tx: " + tx.TxID.String() + addrByAliasGo, addrByAliasScala := utl.GetAddressesByAlias(&suite.BaseSuite, td.Alias) - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) + utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddress.Bytes(), addrByAliasGo, addrByAliasScala, + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) }) } } @@ -60,29 +70,29 @@ func (suite *AliasTxApiSuite) Test_AliasTxApiMaxValuesPositive() { func (suite *AliasTxApiSuite) Test_AliasTxApiNegative() { versions := alias_utilities.GetVersions(&suite.BaseSuite) waitForTx := false + txIds := make(map[string]*crypto.Digest) for _, v := range versions { tdmatrix := testdata.GetAliasNegativeDataMatrix(&suite.BaseSuite) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, _, actualDiffBalanceInWaves := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) - - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Alias Tx: " + tx.TxID.String() + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds, "Version: %#v", v) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *AliasTxApiSuite) Test_SameAliasApiNegative() { @@ -90,45 +100,46 @@ func (suite *AliasTxApiSuite) Test_SameAliasApiNegative() { waitForTx := true name := "Values for same alias" //Count of tx id in blockchain after tx, for v1 and v2 it should be 2: 1 for each node - var idsCount = 2 + txIds := make(map[string]*crypto.Digest) for _, v := range versions { - txIds := make(map[string]*crypto.Digest) tdslice := testdata.GetSameAliasNegativeDataMatrix(&suite.BaseSuite) for _, td := range tdslice { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //first alias tx should be successful tx1, _, actualDiffBalanceInWaves1 := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx1, utl.GetTestcaseNameWithVersion(name, v)) + errMsg := caseName + "Broadcast Alias Tx1: " + tx1.TxID.String() addrByAliasGo, addrByAliasScala := utl.GetAddressesByAlias(&suite.BaseSuite, td.Alias) - utl.TxInfoCheck(suite.T(), tx1.WtErr.ErrWtGo, tx1.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v), - tx1.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx1, errMsg) + utl.TxInfoCheck(suite.T(), tx1.WtErr.ErrWtGo, tx1.WtErr.ErrWtScala, "Alias: "+tx1.TxID.String()) utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddressAfterFirstTx.Bytes(), addrByAliasGo, - addrByAliasScala) + addrByAliasScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceAfterFirstTx, - actualDiffBalanceInWaves1.BalanceInWavesGo, - actualDiffBalanceInWaves1.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves1.BalanceInWavesGo, actualDiffBalanceInWaves1.BalanceInWavesScala, + errMsg) //second alias tx with same alias had same ID for v1 and v2 tx2, _, actualDiffBalanceInWaves2 := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, !waitForTx) - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx2, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg = caseName + "Broadcast Alias Tx2: " + tx2.TxID.String() //already there for v1 and v2, and should be new for v3 txIds[name] = &tx2.TxID + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx2, + errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx2.BrdCstErr.ErrorBrdCstGo, tx2.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) + tx2.BrdCstErr.ErrorBrdCstGo, tx2.BrdCstErr.ErrorBrdCstScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves2.BalanceInWavesGo, - actualDiffBalanceInWaves2.BalanceInWavesScala) + actualDiffBalanceInWaves2.BalanceInWavesScala, errMsg) }) } - //should have same tx ID for Go and Scala v1 and v2 - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds, "Version:", v) } + //should have same tx ID for Go and Scala v1 and v2 + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 2, "IDs: %#v", actualTxIds) } func (suite *AliasTxApiSuite) Test_SameAliasDiffAddressesApiNegative() { @@ -136,19 +147,21 @@ func (suite *AliasTxApiSuite) Test_SameAliasDiffAddressesApiNegative() { waitForTx := true name := "Same alias for different accounts " var idsCount = 2 + txIds := make(map[string]*crypto.Digest) for _, v := range versions { tdSlice := testdata.GetSameAliasDiffAddressNegativeDataMatrix(&suite.BaseSuite) - txIds := make(map[string]*crypto.Digest) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //send alias tx from account that is in first element of testdata slice tx, _, actualDiffBalanceInWaves := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, tdSlice[0], v, waitForTx) + errMsg := caseName + "Broadcast Alias Tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), tdSlice[0].Expected.WavesDiffBalanceAfterFirstTx, - actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesScala) + actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesScala, + errMsg) //send alias tx from account that is in each next slice element for j := 1; j < len(tdSlice); j++ { tx, _, actualDiffBalanceInWaves := alias_utilities.BroadcastAliasTxAndGetWavesBalances(&suite.BaseSuite, @@ -156,21 +169,22 @@ func (suite *AliasTxApiSuite) Test_SameAliasDiffAddressesApiNegative() { txIds[name] = &tx.TxID utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - + errMsg) utl.WavesDiffBalanceCheck(suite.T(), tdSlice[j].Expected.WavesDiffBalance, - actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesGo) + actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesGo, + errMsg) //because of new IDs for v3 if v == 3 { idsCount = 0 utl.ErrorMessageCheck(suite.T(), tdSlice[j].Expected.ErrBrdCstGoMsg, tdSlice[j].Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, + errMsg) } } }) - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds, "Version: %#v", v) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds) } func TestAliasTxApiSuite(t *testing.T) { diff --git a/itests/alias_tx_test.go b/itests/alias_tx_test.go index 0d05137e7..1f459450b 100644 --- a/itests/alias_tx_test.go +++ b/itests/alias_tx_test.go @@ -22,16 +22,19 @@ func (suite *AliasTxSuite) Test_AliasPositive() { for _, v := range versions { tdmatrix := testdata.GetAliasPositiveDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { - tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { + tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, + v, waitForTx) addrByAliasGo, addrByAliasScala := utl.GetAddressesByAlias(&suite.BaseSuite, td.Alias) + errMsg := caseName + "Alias Tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) - utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddress.Bytes(), addrByAliasGo, addrByAliasScala) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) + utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddress.Bytes(), addrByAliasGo, addrByAliasScala, + errMsg) utl.WavesDiffBalanceCheck( suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) }) } } @@ -45,15 +48,18 @@ func (suite *AliasTxSuite) Test_AliasMaxValuesPositive() { utl.DefaultAccountForLoanFunds, 10000000000) tdmatrix := testdata.GetAliasMaxPositiveDataMatrix(&suite.BaseSuite, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { - tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { + tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, + v, waitForTx) addrByAliasGo, addrByAliasScala := utl.GetAddressesByAlias(&suite.BaseSuite, td.Alias) + errMsg := caseName + "Alias Tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) - utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddress.Bytes(), addrByAliasGo, addrByAliasScala) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) + utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddress.Bytes(), addrByAliasGo, addrByAliasScala, + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) }) } } @@ -62,23 +68,26 @@ func (suite *AliasTxSuite) Test_AliasMaxValuesPositive() { func (suite *AliasTxSuite) Test_AliasNegative() { versions := alias_utilities.GetVersions(&suite.BaseSuite) waitForTx := false + txIds := make(map[string]*crypto.Digest) for _, v := range versions { tdmatrix := testdata.GetAliasNegativeDataMatrix(&suite.BaseSuite) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { - tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { + tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, + v, waitForTx) txIds[name] = &tx.TxID + errMsg := caseName + "Alias Tx: " + tx.TxID.String() utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds, "Version: %#v", v) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *AliasTxSuite) Test_SameAliasNegative() { @@ -87,76 +96,80 @@ func (suite *AliasTxSuite) Test_SameAliasNegative() { name := "Values for same alias" //Count of tx id in blockchain after tx, for v1 and v2 it should be 2: 1 for each node var idsCount = 2 + txIds := make(map[string]*crypto.Digest) for _, v := range versions { - txIds := make(map[string]*crypto.Digest) tdslice := testdata.GetSameAliasNegativeDataMatrix(&suite.BaseSuite) for _, td := range tdslice { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //first alias tx should be successful tx1, _, actualDiffBalanceInWaves1 := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, waitForTx) addrByAliasGo, addrByAliasScala := utl.GetAddressesByAlias(&suite.BaseSuite, td.Alias) + errMsg := caseName + "Alias Tx1: " + tx1.TxID.String() - utl.TxInfoCheck(suite.T(), tx1.WtErr.ErrWtGo, tx1.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx1.TxID.String()) + utl.TxInfoCheck(suite.T(), tx1.WtErr.ErrWtGo, tx1.WtErr.ErrWtScala, errMsg) utl.AddressByAliasCheck(suite.T(), td.Expected.ExpectedAddressAfterFirstTx.Bytes(), - addrByAliasGo, addrByAliasScala, utl.GetTestcaseNameWithVersion(name, v)) + addrByAliasGo, addrByAliasScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceAfterFirstTx, actualDiffBalanceInWaves1.BalanceInWavesGo, actualDiffBalanceInWaves1.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //second alias tx with same alias had same ID for v1 and v2 tx2, _, actualDiffBalanceInWaves2 := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, td, v, !waitForTx) //already there for v1 and v2, and should be new for v3 txIds[name] = &tx2.TxID + errMsg = caseName + "Alias Tx2: " + tx2.TxID.String() utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves2.BalanceInWavesGo, - actualDiffBalanceInWaves2.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves2.BalanceInWavesScala, errMsg) }) } - //should have same tx ID for Go and Scala v1 and v2 - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds, "Version:", v) } + //should have same tx ID for Go and Scala v1 and v2 + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds) } func (suite *AliasTxSuite) Test_SameAliasDiffAddressesNegative() { versions := alias_utilities.GetVersions(&suite.BaseSuite) waitForTx := true - name := "Same alias for different accounts " + name := "Same alias for different accounts" var idsCount = 2 + txIds := make(map[string]*crypto.Digest) for _, v := range versions { tdSlice := testdata.GetSameAliasDiffAddressNegativeDataMatrix(&suite.BaseSuite) - txIds := make(map[string]*crypto.Digest) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //send alias tx from account that is in first element of testdata slice tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, tdSlice[0], v, waitForTx) + errMsg := caseName + "Alias Tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), tdSlice[0].Expected.WavesDiffBalanceAfterFirstTx, - actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesScala) + actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) //send alias tx from account that is in each next slice element for j := 1; j < len(tdSlice); j++ { tx, _, actualDiffBalanceInWaves := alias_utilities.SendAliasTxAndGetWavesBalances(&suite.BaseSuite, tdSlice[j], v, !waitForTx) txIds[name] = &tx.TxID + errMsg = caseName + "Alias Tx: " + tx.TxID.String() utl.WavesDiffBalanceCheck(suite.T(), tdSlice[j].Expected.WavesDiffBalance, - actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesGo) + actualDiffBalanceInWaves.BalanceInWavesGo, actualDiffBalanceInWaves.BalanceInWavesGo, errMsg) //because of new IDs for v3 if v == 3 { idsCount = 0 utl.ErrorMessageCheck(suite.T(), tdSlice[j].Expected.ErrGoMsg, tdSlice[j].Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) } } }) - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds, "Version: %#v", v) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, idsCount, "IDs: %#v", actualTxIds) } func TestAliasTxSuite(t *testing.T) { diff --git a/itests/burn_tx_api_test.go b/itests/burn_tx_api_test.go index fa0bab992..7fe916195 100644 --- a/itests/burn_tx_api_test.go +++ b/itests/burn_tx_api_test.go @@ -27,18 +27,19 @@ func (suite *BurnTxApiSuite) Test_BurnTxApiPositive() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetBurnPositiveDataMatrix(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.BroadcastBurnTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Burn tx" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -54,18 +55,19 @@ func (suite *BurnTxSuite) Test_BurnTxApiAssetWithMaxAvailableFee() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetBurnAllAssetWithMaxAvailableFee(&suite.BaseSuite, itx.TxID, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.BroadcastBurnTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Burn tx" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -82,25 +84,27 @@ func (suite *BurnTxApiSuite) Test_BurnNFTFromOwnerAccountApiPositive() { transferNFT := testdata.GetCommonTransferData(&suite.BaseSuite, &itx.TxID).NFT tdmatrix := testdata.GetBurnNFTFromOwnerAccount(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //transfer NFT from Account 2 to Account 3 ttx := transfer_utilities.TransferBroadcastWithTestData(&suite.BaseSuite, transferNFT, v, waitForTx) + errMsg := caseName + "Transfer tx" + ttx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, ttx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, ttx, errMsg) utl.TxInfoCheck(suite.BaseSuite.T(), ttx.WtErr.ErrWtGo, ttx.WtErr.ErrWtScala, - "Transfer: "+ttx.TxID.String(), utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //burn NFT from Account 3 tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.BroadcastBurnTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg = caseName + "Broadcast Burn tx" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -109,6 +113,7 @@ func (suite *BurnTxApiSuite) Test_BurnNFTFromOwnerAccountApiPositive() { func (suite *BurnTxApiSuite) Test_BurnTxApiNegative() { versions := burn_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) @@ -117,30 +122,29 @@ func (suite *BurnTxApiSuite) Test_BurnTxApiNegative() { if v >= 2 { maps.Copy(tdmatrix, testdata.GetBurnChainIDNegativeDataMatrix(&suite.BaseSuite, itx.TxID)) } - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.BroadcastBurnTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Burn tx" + tx.TxID.String() utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - - txIds[name] = &tx.TxID - + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String()) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, "Burn: "+tx.TxID.String()) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, "Burn: "+tx.TxID.String()) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestBurnTxApiSuite(t *testing.T) { diff --git a/itests/burn_tx_test.go b/itests/burn_tx_test.go index af7f97af6..d9bc518f3 100644 --- a/itests/burn_tx_test.go +++ b/itests/burn_tx_test.go @@ -26,16 +26,17 @@ func (suite *BurnTxSuite) Test_BurnTxPositive() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetBurnPositiveDataMatrix(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.SendBurnTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Burn tx" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -51,16 +52,17 @@ func (suite *BurnTxSuite) Test_BurnTxAssetWithMaxAvailableFeePositive() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetBurnAllAssetWithMaxAvailableFee(&suite.BaseSuite, itx.TxID, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.SendBurnTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Burn tx" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -77,23 +79,24 @@ func (suite *BurnTxSuite) Test_BurnNFTFromOwnerAccountPositive() { transferNFT := testdata.GetCommonTransferData(&suite.BaseSuite, &itx.TxID).NFT tdmatrix := testdata.GetBurnNFTFromOwnerAccount(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //transfer NFT from Account 2 to Account 3 ttx := transfer_utilities.TransferSendWithTestData(&suite.BaseSuite, transferNFT, v, waitForTx) + errMsg := caseName + "Transfer tx" + ttx.TxID.String() - utl.TxInfoCheck(suite.BaseSuite.T(), ttx.WtErr.ErrWtGo, ttx.WtErr.ErrWtScala, - "Transfer: "+ttx.TxID.String(), utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.BaseSuite.T(), ttx.WtErr.ErrWtGo, ttx.WtErr.ErrWtScala, errMsg) //burn NFT from Account 3 tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.SendBurnTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg = caseName + "Burn tx" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Burn: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -102,6 +105,7 @@ func (suite *BurnTxSuite) Test_BurnNFTFromOwnerAccountPositive() { func (suite *BurnTxSuite) Test_BurnTxNegative() { versions := burn_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) @@ -110,24 +114,25 @@ func (suite *BurnTxSuite) Test_BurnTxNegative() { if v >= 2 { maps.Copy(tdmatrix, testdata.GetBurnChainIDNegativeDataMatrix(&suite.BaseSuite, itx.TxID)) } - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := burn_utilities.SendBurnTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) txIds[name] = &tx.TxID + errMsg := caseName + "Burn tx" + tx.TxID.String() utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestBurnTxSuite(t *testing.T) { diff --git a/itests/issue_smart_asset_api_test.go b/itests/issue_smart_asset_api_test.go index ccfc0242d..4b4f83320 100644 --- a/itests/issue_smart_asset_api_test.go +++ b/itests/issue_smart_asset_api_test.go @@ -22,20 +22,22 @@ func (suite *IssueSmartAssetApiSuite) Test_IssueSmartAssetApiPositive() { for _, v := range versions { tdmatrix := testdata.GetPositiveAssetScriptData(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.BroadcastIssueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Issue smart asset tx:" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) assetDetailsGo, assetDetailsScala := utl.GetAssetInfoGrpc(&suite.BaseSuite, tx.TxID) - utl.AssetScriptCheck(suite.T(), td.Script, assetDetailsGo.Script.ScriptBytes, assetDetailsScala.Script.ScriptBytes) + utl.AssetScriptCheck(suite.T(), td.Script, assetDetailsGo.Script.ScriptBytes, assetDetailsScala.Script.ScriptBytes, + errMsg) }) } } @@ -48,28 +50,27 @@ func (suite *IssueSmartAssetApiSuite) Test_IssueSmartAssetApiNegative() { for _, v := range versions { tdmatrix := testdata.GetNegativeAssetScriptData(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.BroadcastIssueTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) - - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Issue smart asset tx:" + tx.TxID.String() + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestIssueSmartAssetApiSuite(t *testing.T) { diff --git a/itests/issue_smart_asset_test.go b/itests/issue_smart_asset_test.go index 2beaa0950..c1757a142 100644 --- a/itests/issue_smart_asset_test.go +++ b/itests/issue_smart_asset_test.go @@ -21,19 +21,21 @@ func (suite *IssueSmartAssetSuite) Test_IssueSmartAssetPositive() { for _, v := range versions { tdmatrix := testdata.GetPositiveAssetScriptData(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.SendIssueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Issue smart asset tx:" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) assetDetailsGo, assetDetailsScala := utl.GetAssetInfoGrpc(&suite.BaseSuite, tx.TxID) - utl.AssetScriptCheck(suite.T(), td.Script, assetDetailsGo.Script.ScriptBytes, assetDetailsScala.Script.ScriptBytes) + utl.AssetScriptCheck(suite.T(), td.Script, assetDetailsGo.Script.ScriptBytes, assetDetailsScala.Script.ScriptBytes, + errMsg) }) } } @@ -47,22 +49,24 @@ func (suite *IssueSmartAssetSuite) Test_IssueSmartAssetNegative() { for _, v := range versions { tdmatrix := testdata.GetNegativeAssetScriptData(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.SendIssueTxAndGetBalances(&suite.BaseSuite, td, v, !waitForTx) txIds[name] = &tx.TxID + errMsg := caseName + "Issue smart asset tx:" + tx.TxID.String() utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestIssueSmartAssetSuite(t *testing.T) { diff --git a/itests/issue_tx_api_test.go b/itests/issue_tx_api_test.go index 18e93684a..a51cbee33 100644 --- a/itests/issue_tx_api_test.go +++ b/itests/issue_tx_api_test.go @@ -22,17 +22,18 @@ func (suite *IssueTxApiSuite) Test_IssueTxApiPositive() { for _, v := range versions { tdmatrix := testdata.GetPositiveDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.BroadcastIssueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Issue tx:" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -44,18 +45,19 @@ func (suite *IssueTxApiSuite) Test_IssueTxApiWithSameDataPositive() { for _, v := range versions { tdmatrix := testdata.GetPositiveDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { for j := 0; j < 2; j++ { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.BroadcastIssueTxAndGetBalances(&suite.BaseSuite, testdata.DataChangedTimestamp(&td), v, waitForTx) + errMsg := caseName + "Broadcast Issue tx:" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) } }) } @@ -69,28 +71,27 @@ func (suite *IssueTxApiSuite) Test_IssueTxApiNegative() { for _, v := range versions { tdmatrix := testdata.GetNegativeDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.BroadcastIssueTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) - - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Issue tx:" + tx.TxID.String() + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestIssueTxApiSuite(t *testing.T) { diff --git a/itests/issue_tx_test.go b/itests/issue_tx_test.go index d54806f0f..dc353536d 100644 --- a/itests/issue_tx_test.go +++ b/itests/issue_tx_test.go @@ -21,16 +21,17 @@ func (suite *IssueTxSuite) Test_IssueTxPositive() { for _, v := range versions { tdmatrix := testdata.GetPositiveDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.SendIssueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Issue tx:" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -43,17 +44,18 @@ func (suite *IssueTxSuite) Test_IssueTxWithSameDataPositive() { for _, v := range versions { tdmatrix := testdata.GetPositiveDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { for j := 0; j < 2; j++ { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.SendIssueTxAndGetBalances(&suite.BaseSuite, testdata.DataChangedTimestamp(&td), v, waitForTx) + errMsg := caseName + "Issue tx:" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - utl.GetTestcaseNameWithVersion(name, v), tx.TxID.String()) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) } }) } @@ -67,22 +69,24 @@ func (suite *IssueTxSuite) Test_IssueTxNegative() { for _, v := range versions { tdmatrix := testdata.GetNegativeDataMatrix(&suite.BaseSuite) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := issue_utilities.SendIssueTxAndGetBalances(&suite.BaseSuite, td, v, !waitForTx) txIds[name] = &tx.TxID + errMsg := caseName + "Issue tx:" + tx.TxID.String() utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestIssueTxSuite(t *testing.T) { diff --git a/itests/reissue_tx_api_test.go b/itests/reissue_tx_api_test.go index ef900ba10..e848777c7 100644 --- a/itests/reissue_tx_api_test.go +++ b/itests/reissue_tx_api_test.go @@ -26,17 +26,18 @@ func (suite *ReissueTxApiSuite) Test_ReissueTxApiPositive() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetReissuePositiveDataMatrix(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.BroadcastReissueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Reissue tx:" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Reissue: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -50,17 +51,18 @@ func (suite *ReissueTxApiSuite) Test_ReissueTxApiMaxQuantityPositive() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetReissueMaxQuantityValue(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.BroadcastReissueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Reissue tx:" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Reissue: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -69,84 +71,85 @@ func (suite *ReissueTxApiSuite) Test_ReissueTxApiMaxQuantityPositive() { func (suite *ReissueTxApiSuite) Test_ReissueNotReissuableApiNegative() { versions := reissue_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetNotReissuableTestData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //first tx should be successful tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.BroadcastReissueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Reissue tx:" + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Reissue: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.Positive.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.Positive.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) //second reissue tx should be failed because of reissuable=false tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset = reissue_utilities.BroadcastReissueTxAndGetBalances( &suite.BaseSuite, testdata.ReissueDataChangedTimestamp(&td), v, !waitForTx) + errMsg = caseName + "Broadcast Reissue tx2:" + tx.TxID.String() + txIds[name] = &tx.TxID utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.Negative.ErrBrdCstGoMsg, td.Expected.Negative.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - - txIds[name] = &tx.TxID - + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.Negative.ErrGoMsg, td.Expected.Negative.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.Negative.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.Negative.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *ReissueTxApiSuite) Test_ReissueTxApiNFTNegative() { versions := reissue_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { nft := testdata.GetCommonIssueData(&suite.BaseSuite).NFT itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, nft, v, waitForTx) tdmatrix := testdata.GetReissueNFTData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.BroadcastReissueTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) - - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Reissue tx:" + tx.TxID.String() - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *ReissueTxApiSuite) Test_ReissueTxApiNegative() { versions := reissue_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) @@ -155,29 +158,28 @@ func (suite *ReissueTxApiSuite) Test_ReissueTxApiNegative() { if v >= 2 { maps.Copy(tdmatrix, testdata.GetReissueChainIDNegativeDataMatrix(&suite.BaseSuite, itx.TxID)) } - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.BroadcastReissueTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) - - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Reissue tx:" + tx.TxID.String() - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestReissueTxApiSuite(t *testing.T) { diff --git a/itests/reissuie_tx_test.go b/itests/reissuie_tx_test.go index 71b983ad1..37d47e06d 100644 --- a/itests/reissuie_tx_test.go +++ b/itests/reissuie_tx_test.go @@ -25,16 +25,17 @@ func (suite *ReissueTxSuite) Test_ReissuePositive() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetReissuePositiveDataMatrix(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.SendReissueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Reissue tx:" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Reissue: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -48,18 +49,18 @@ func (suite *ReissueTxSuite) Test_ReissueMaxQuantityPositive() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetReissueMaxQuantityValue(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.SendReissueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Reissue tx:" + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Reissue: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) - } } } @@ -67,71 +68,77 @@ func (suite *ReissueTxSuite) Test_ReissueMaxQuantityPositive() { func (suite *ReissueTxSuite) Test_ReissueNotReissuableNegative() { versions := reissue_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetNotReissuableTestData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //first tx should be successful tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.SendReissueTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Reissue: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + errMsg := caseName + "Reissue tx:" + tx.TxID.String() + + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.Positive.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.Positive.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) //second reissue tx should be failed because of reissuable=false tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset = reissue_utilities.SendReissueTxAndGetBalances( &suite.BaseSuite, testdata.ReissueDataChangedTimestamp(&td), v, !waitForTx) txIds[name] = &tx.TxID + errMsg = caseName + "Broadcast Reissue tx2:" + tx.TxID.String() utl.ErrorMessageCheck(suite.T(), td.Expected.Negative.ErrGoMsg, td.Expected.Negative.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.Negative.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.Negative.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *ReissueTxSuite) Test_ReissueNFTNegative() { versions := reissue_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { nft := testdata.GetCommonIssueData(&suite.BaseSuite).NFT itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, nft, v, waitForTx) tdmatrix := testdata.GetReissueNFTData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.SendReissueTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) txIds[name] = &tx.TxID + errMsg := caseName + "Reissue tx:" + tx.TxID.String() utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *ReissueTxSuite) Test_ReissueNegative() { versions := reissue_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) @@ -140,23 +147,25 @@ func (suite *ReissueTxSuite) Test_ReissueNegative() { if v >= 2 { maps.Copy(tdmatrix, testdata.GetReissueChainIDNegativeDataMatrix(&suite.BaseSuite, itx.TxID)) } - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := reissue_utilities.SendReissueTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) txIds[name] = &tx.TxID + errMsg := caseName + "Reissue tx:" + tx.TxID.String() - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestReissueTxSuite(t *testing.T) { diff --git a/itests/set_asset_script_tx_api_test.go b/itests/set_asset_script_tx_api_test.go index a2b2a9c9a..17ebf3993 100644 --- a/itests/set_asset_script_tx_api_test.go +++ b/itests/set_asset_script_tx_api_test.go @@ -25,17 +25,18 @@ func (suite *SetAssetScriptApiSuite) Test_SetAssetScriptApiPositive() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, smartAsset, v, waitForTx) tdmatrix := testdata.GetSetAssetScriptPositiveData(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := set_asset_script_utilities.BroadcastSetAssetScriptTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Set Asset Script tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Set Asset Script: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -50,23 +51,23 @@ func (suite *SetAssetScriptApiSuite) Test_SetAssetScriptApiNegative() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, smartAsset, v, waitForTx) tdmatrix := testdata.GetSetAssetScriptNegativeData(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := set_asset_script_utilities.BroadcastSetAssetScriptTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Set Asset Script tx: " + tx.TxID.String() utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - - txIds[name] = &tx.TxID - + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -83,23 +84,22 @@ func (suite *SetAssetScriptApiSuite) Test_SetScriptForNotScriptedAssetApiNegativ itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, asset, v, waitForTx) name := "Set script for not scripted asset" td := testdata.GetSimpleSmartAssetNegativeData(&suite.BaseSuite, itx.TxID) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := set_asset_script_utilities.BroadcastSetAssetScriptTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) - - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - txIds[name] = &tx.TxID + errMsg := caseName + "Broadcast Set Asset Script tx: " + tx.TxID.String() + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) diff --git a/itests/set_asset_script_tx_test.go b/itests/set_asset_script_tx_test.go index 5d53d118e..f158a0b81 100644 --- a/itests/set_asset_script_tx_test.go +++ b/itests/set_asset_script_tx_test.go @@ -24,16 +24,17 @@ func (suite *SetAssetScriptSuite) Test_SetAssetScriptPositive() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, smartAsset, v, waitForTx) tdmatrix := testdata.GetSetAssetScriptPositiveData(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := set_asset_script_utilities.SendSetAssetScriptTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Set Asset Script tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Set Asset Script: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -48,17 +49,19 @@ func (suite *SetAssetScriptSuite) Test_SetAssetScriptNegative() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, smartAsset, v, waitForTx) tdmatrix := testdata.GetSetAssetScriptNegativeData(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := set_asset_script_utilities.SendSetAssetScriptTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Set Asset Script tx: " + tx.TxID.String() txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -75,17 +78,19 @@ func (suite *SetAssetScriptSuite) Test_SetScriptForNotScriptedAssetNegative() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, asset, v, waitForTx) name := "Set script for not scripted asset" td := testdata.GetSimpleSmartAssetNegativeData(&suite.BaseSuite, itx.TxID) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := set_asset_script_utilities.SendSetAssetScriptTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Set Asset Script tx: " + tx.TxID.String() txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, - tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala) + tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) diff --git a/itests/sponsorship_tx_api_test.go b/itests/sponsorship_tx_api_test.go index c2acecb80..dc43471c9 100644 --- a/itests/sponsorship_tx_api_test.go +++ b/itests/sponsorship_tx_api_test.go @@ -26,17 +26,18 @@ func (suite *SponsorshipTxApiSuite) TestSponsorshipTxApiPositive() { itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetSponsorshipPositiveDataMatrix(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.BroadcastSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -53,17 +54,18 @@ func (suite *SponsorshipTxApiSuite) TestSponsorshipTxApiMaxValues() { transfer_utilities.TransferAssetAmount(&suite.BaseSuite, v, utl.TestChainID, itxID, utl.DefaultSenderNotMiner, n) tdmatrix := testdata.GetSponsorshipMaxValuesPositive(&suite.BaseSuite, itxID, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.BroadcastSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -77,30 +79,31 @@ func (suite *SponsorshipTxApiSuite) TestSponsorshipDisabledTxApi() { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) sponsorship := testdata.GetSponsorshipEnabledDisabledData(&suite.BaseSuite, itx.TxID) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //switch on sponsorship tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.BroadcastSponsorshipTxAndGetBalances( &suite.BaseSuite, sponsorship.Enabled, v, waitForTx) + errMsg := caseName + "Broadcast Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), sponsorship.Enabled.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), sponsorship.Enabled.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) //switch off sponsorship tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset = sponsor_utilities.BroadcastSponsorshipTxAndGetBalances( &suite.BaseSuite, sponsorship.Disabled, v, waitForTx) + errMsg = caseName + "Broadcast Sponsorship Disabled tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship Disabled: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), sponsorship.Disabled.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), sponsorship.Disabled.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -108,65 +111,66 @@ func (suite *SponsorshipTxApiSuite) TestSponsorshipDisabledTxApi() { func (suite *SponsorshipTxApiSuite) TestSponsorshipTxApiNegative() { versions := sponsor_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetSponsorshipNegativeDataMatrix(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) - for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.BroadcastSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Broadcast Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *SponsorshipTxApiSuite) Test_SponsorshipForSmartAssetApiNegative() { versions := sponsor_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { smart := testdata.GetCommonIssueData(&suite.BaseSuite).Smart itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, smart, v, waitForTx) td := testdata.GetSponsorshipForSmartAssetData(&suite.BaseSuite, itx.TxID).Enabled name := "Check sponsorship for smart asset" - txIds := make(map[string]*crypto.Digest) - - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.BroadcastSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, utl.GetTestcaseNameWithVersion(name, v)) - utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) - + errMsg := caseName + "Broadcast Sponsorship tx: " + tx.TxID.String() txIds[name] = &tx.TxID + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) + utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestSponsorshipTxApiSuite(t *testing.T) { diff --git a/itests/sponsorship_tx_test.go b/itests/sponsorship_tx_test.go index 7673987d1..f40e56b0c 100644 --- a/itests/sponsorship_tx_test.go +++ b/itests/sponsorship_tx_test.go @@ -25,16 +25,17 @@ func (suite *SponsorshipTxSuite) TestSponsorshipTxPositive() { itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetSponsorshipPositiveDataMatrix(&suite.BaseSuite, itx.TxID) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.SendSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Sponsorship tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -51,16 +52,17 @@ func (suite *SponsorshipTxSuite) TestSponsorshipTxMaxValues() { transfer_utilities.TransferAssetAmount(&suite.BaseSuite, v, utl.TestChainID, itxID, utl.DefaultSenderNotMiner, n) tdmatrix := testdata.GetSponsorshipMaxValuesPositive(&suite.BaseSuite, itxID, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.SendSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Sponsorship tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -74,28 +76,29 @@ func (suite *SponsorshipTxSuite) TestSponsorshipDisabledTx() { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) sponsorship := testdata.GetSponsorshipEnabledDisabledData(&suite.BaseSuite, itx.TxID) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //switch on sponsorship tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.SendSponsorshipTxAndGetBalances( &suite.BaseSuite, sponsorship.Enabled, v, waitForTx) + errMsg := caseName + "Sponsorship tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), sponsorship.Enabled.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), sponsorship.Enabled.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) //switch off sponsorship tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset = sponsor_utilities.SendSponsorshipTxAndGetBalances( &suite.BaseSuite, sponsorship.Disabled, v, waitForTx) + errMsg = caseName + "Sponsorship Disabled tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Sponsorship Disabled: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), sponsorship.Disabled.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), sponsorship.Disabled.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } } @@ -103,56 +106,62 @@ func (suite *SponsorshipTxSuite) TestSponsorshipDisabledTx() { func (suite *SponsorshipTxSuite) TestSponsorshipTxNegative() { versions := sponsor_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) + for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetSponsorshipNegativeDataMatrix(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.SendSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Sponsorship tx: " + tx.TxID.String() + txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *SponsorshipTxSuite) Test_SponsorshipForSmartAssetNegative() { versions := sponsor_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { smart := testdata.GetCommonIssueData(&suite.BaseSuite).Smart itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, smart, v, waitForTx) td := testdata.GetSponsorshipForSmartAssetData(&suite.BaseSuite, itx.TxID).Enabled name := "Check sponsorship for smart asset" - txIds := make(map[string]*crypto.Digest) + caseName := utl.GetTestcaseNameWithVersion(name, v) - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + suite.Run(caseName, func() { tx, actualDiffBalanceInWaves, actualDiffBalanceInAsset := sponsor_utilities.SendSponsorshipTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Sponsorship tx: " + tx.TxID.String() txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceInWaves.BalanceInWavesGo, - actualDiffBalanceInWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actualDiffBalanceInAsset.BalanceInAssetGo, - actualDiffBalanceInAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceInAsset.BalanceInAssetScala, errMsg) }) - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestSponsorshipTxSuite(t *testing.T) { diff --git a/itests/transfer_tx_api_test.go b/itests/transfer_tx_api_test.go index 893011196..97cacab82 100644 --- a/itests/transfer_tx_api_test.go +++ b/itests/transfer_tx_api_test.go @@ -34,34 +34,34 @@ func (suite *TransferTxApiSuite) Test_TransferTxApiPositive() { } for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, testdata.TransferDataChangedTimestamp(&td), v, waitForTx) + errMsg := caseName + "Broadcast Transfer tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - "Broadcast Transfer: "+tx.TxID.String(), utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -77,30 +77,34 @@ func (suite *TransferTxApiSuite) Test_TransferSmartAssetApiPositive() { smart := testdata.GetCommonIssueData(&suite.BaseSuite).Smart itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, smart, sav, waitForTx) td := testdata.GetCommonTransferData(&suite.BaseSuite, &itx.TxID).Smart - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, testdata.TransferDataChangedTimestamp(&td), v, waitForTx) + errMsg := caseName + "Broadcast Transfer tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - "Broadcast Transfer: "+tx.TxID.String(), utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, + errMsg) }) } } @@ -118,35 +122,34 @@ func (suite *TransferTxApiSuite) Test_TransferTxApiMaxAmountAndFeePositive() { tdmatrix := testdata.GetTransferMaxAmountPositive(&suite.BaseSuite, itxID, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Transfer tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, - "Broadcast Transfer: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -155,82 +158,83 @@ func (suite *TransferTxApiSuite) Test_TransferTxApiMaxAmountAndFeePositive() { func (suite *TransferTxApiSuite) Test_TransferTxApiNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetTransferNegativeData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Broadcast Transfer tx: " + tx.TxID.String() + txIds[name] = &tx.TxID - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, - tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, - utl.GetTestcaseNameWithVersion(name, v)) - - txIds[name] = &tx.TxID + tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *TransferTxApiSuite) Test_TransferTxApiChainIDNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueBroadcastWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetTransferChainIDChangedNegativeData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) if v > 2 { maps.Copy(tdmatrix, testdata.GetTransferChainIDDataNegative(&suite.BaseSuite, itx.TxID)) } for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { initBalanceWavesGoSender, initBalanceWavesScalaSender := utl.GetAvailableBalanceInWaves( &suite.BaseSuite, td.Sender.Address) initBalanceAssetGoSender, initBalanceAssetScalaSender := utl.GetAssetBalance( &suite.BaseSuite, td.Sender.Address, td.Asset.ID) tx := transfer_utilities.TransferBroadcastWithTestData(&suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Broadcast Transfer tx: " + tx.TxID.String() txIds[name] = &tx.TxID - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrBrdCstGoMsg, td.Expected.ErrBrdCstScalaMsg, tx.BrdCstErr.ErrorBrdCstGo, tx.BrdCstErr.ErrorBrdCstScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) actualDiffBalanceWavesGoSender, actualDiffBalanceWavesScalaSender := utl.GetActualDiffBalanceInWaves( &suite.BaseSuite, td.Sender.Address, initBalanceWavesGoSender, initBalanceWavesScalaSender) @@ -240,19 +244,19 @@ func (suite *TransferTxApiSuite) Test_TransferTxApiChainIDNegative() { utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceWavesGoSender, actualDiffBalanceWavesScalaSender, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actuallDiffBalanceAssetGoSender, actualDiffBalanceAssetScalaSender, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestTransferTxApiSuite(t *testing.T) { diff --git a/itests/transfer_tx_test.go b/itests/transfer_tx_test.go index 10ebfce1b..07e96cd56 100644 --- a/itests/transfer_tx_test.go +++ b/itests/transfer_tx_test.go @@ -33,28 +33,29 @@ func (suite *TransferTxSuite) Test_TransferTxPositive() { } for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, testdata.TransferDataChangedTimestamp(&td), v, waitForTx) + errMsg := caseName + "Transfer tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, errMsg) }) } } @@ -70,28 +71,29 @@ func (suite *TransferTxSuite) Test_TransferSmartAssetPositive() { smart := testdata.GetCommonIssueData(&suite.BaseSuite).Smart itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, smart, sav, waitForTx) td := testdata.GetCommonTransferData(&suite.BaseSuite, &itx.TxID).Smart - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, testdata.TransferDataChangedTimestamp(&td), v, waitForTx) + errMsg := caseName + "Transfer tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, errMsg) }) } } @@ -109,28 +111,29 @@ func (suite *TransferTxSuite) Test_TransferTxMaxAmountAndFeePositive() { tdmatrix := testdata.GetTransferMaxAmountPositive(&suite.BaseSuite, itxID, n) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Transfer tx: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, errMsg) }) } } @@ -139,65 +142,69 @@ func (suite *TransferTxSuite) Test_TransferTxMaxAmountAndFeePositive() { func (suite *TransferTxSuite) Test_TransferTxNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) + for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetTransferNegativeData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Transfer tx: " + tx.TxID.String() txIds[name] = &tx.TxID utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, - diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, - diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, utl.GetTestcaseNameWithVersion(name, v)) + diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *TransferTxSuite) Test_TransferTxChainIDNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) for _, v := range versions { reissuable := testdata.GetCommonIssueData(&suite.BaseSuite).Reissuable itx := issue_utilities.IssueSendWithTestData(&suite.BaseSuite, reissuable, v, waitForTx) tdmatrix := testdata.GetTransferChainIDChangedNegativeData(&suite.BaseSuite, itx.TxID) - txIds := make(map[string]*crypto.Digest) - if v > 2 { maps.Copy(tdmatrix, testdata.GetTransferChainIDDataNegative(&suite.BaseSuite, itx.TxID)) } for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { initBalanceWavesGoSender, initBalanceWavesScalaSender := utl.GetAvailableBalanceInWaves( &suite.BaseSuite, td.Sender.Address) initBalanceAssetGoSender, initBalanceAssetScalaSender := utl.GetAssetBalance( &suite.BaseSuite, td.Sender.Address, td.Asset.ID) tx := transfer_utilities.TransferSendWithTestData(&suite.BaseSuite, td, v, !waitForTx) + errMsg := caseName + "Transfer tx: " + tx.TxID.String() txIds[name] = &tx.TxID actualDiffBalanceWavesGoSender, actualDiffBalanceWavesScalaSender := utl.GetActualDiffBalanceInWaves( @@ -207,18 +214,18 @@ func (suite *TransferTxSuite) Test_TransferTxChainIDNegative() { &suite.BaseSuite, td.Sender.Address, td.Asset.ID, initBalanceAssetGoSender, initBalanceAssetScalaSender) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalance, actualDiffBalanceWavesGoSender, - actualDiffBalanceWavesScalaSender, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceWavesScalaSender, errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalance, actuallDiffBalanceAssetGoSender, - actualDiffBalanceAssetScalaSender, utl.GetTestcaseNameWithVersion(name, v)) + actualDiffBalanceAssetScalaSender, errMsg) utl.ErrorMessageCheck(suite.T(), td.Expected.ErrGoMsg, td.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) }) } - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestTransferTxSuite(t *testing.T) { diff --git a/itests/transfer_with_sponsorship_api_test.go b/itests/transfer_with_sponsorship_api_test.go index d57be5197..4f8adb338 100644 --- a/itests/transfer_with_sponsorship_api_test.go +++ b/itests/transfer_with_sponsorship_api_test.go @@ -41,15 +41,16 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipApiPo tdmatrix := testdata.GetSponsoredTransferPositiveData(&suite.BaseSuite, assetId, sponsoredAssetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Transfer with Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Broadcast Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) //RecipientSender balance in Waves does not change because of fee in sponsored asset //RecipientSender balance of tokens (waves) is reduced by the amount of tokens that transferred to Recipient @@ -57,41 +58,41 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipApiPo utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Recipient balance in Waves changes if Waves were transferred //Recipient Asset balance increases by the asset amount being transferred utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor Asset balance increases by amount of fee in sponsored asset that was used by RecipientSender utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } @@ -115,52 +116,53 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipToOne tdmatrix := testdata.GetSposoredTransferBySponsorAsSender(&suite.BaseSuite, sponsoredAssetId, assetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor transfers assets to himself, sponsored asset is used as fee asset tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Broadcast Transfer with Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Broadcast Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor asset balance does not change utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -187,7 +189,8 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestFeeInWavesAccordingMinSponso sponsoredAssetId, assetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableBroadcast(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -195,11 +198,11 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestFeeInWavesAccordingMinSponso //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, waitForTx) + errMsg := caseName + "Broadcast Transfer with Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Broadcast Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) //RecipientSender balance in Waves does not change because of fee in sponsored asset //RecipientSender balance of tokens (waves) is reduced by the amount of tokens that transferred to Recipient @@ -207,41 +210,41 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestFeeInWavesAccordingMinSponso utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Recipient balance in Waves changes if Waves were transferred //Recipient Asset balance increases by the asset amount being transferred utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor Asset balance increases by amount of fee in sponsored asset that was used by RecipientSender utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -268,7 +271,8 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipMaxVa assetId, testdata.Sponsor, testdata.RecipientSender) tdmatrix := testdata.GetTransferWithSponsorshipMaxAmountPositive(&suite.BaseSuite, sponsoredAssetId, assetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableBroadcast(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -276,11 +280,10 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipMaxVa //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, waitForTx) + errMsg := caseName + "Broadcast Transfer with Sponsorship tx: " + tx.TxID.String() - utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, - utl.GetTestcaseNameWithVersion(name, v)) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Broadcast Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusOK, http.StatusOK, tx, errMsg) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) //RecipientSender balance in Waves does not change because of fee in sponsored asset //RecipientSender balance of tokens (waves) is reduced by the amount of tokens that transferred to Recipient @@ -288,41 +291,41 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipMaxVa utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Recipient balance in Waves changes if Waves were transferred //Recipient Asset balance increases by the asset amount being transferred utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor Asset balance increases by amount of fee in sponsored asset that was used by RecipientSender utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -331,6 +334,8 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipMaxVa func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipApiNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) + for _, v := range versions { //Sponsor creates a new token sponsoredAssetId := issue_utilities.IssueAssetAmount(&suite.BaseSuite, testdata.IssueMaxVersion, utl.TestChainID, @@ -345,9 +350,9 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipApiNe transfer_utilities.TransferAssetAmount(&suite.BaseSuite, testdata.TransferMaxVersion, utl.TestChainID, assetId, testdata.Sponsor, testdata.RecipientSender) tdmatrix := testdata.GetTransferWithSponsorshipMaxValuesDataNegative(&suite.BaseSuite, sponsoredAssetId, assetId) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableBroadcast(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -355,62 +360,64 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestTransferWithSponsorshipApiNe //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, !waitForTx) + errMsg := caseName + "Broadcast Transfer with Sponsorship tx: " + tx.TxID.String() txIds[name] = &tx.TxID - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) utl.ErrorMessageCheck(suite.T(), td.TransferTestData.Expected.ErrBrdCstGoMsg, td.TransferTestData.Expected.ErrBrdCstScalaMsg, tx.BrdCstErr.ErrorBrdCstGo, - tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.BrdCstErr.ErrorBrdCstScala, errMsg) //Balances of RecipientSender do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Recipient do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Sponsor do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } - //actualTxIds should be empty - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + //actualTxIds should be empty + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *TransferWithSponsorshipApiTxSuite) TestSponsoredTransferFeeApiNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) + for _, v := range versions { //Sponsor creates a new token sponsoredAssetId := issue_utilities.IssueAssetAmount(&suite.BaseSuite, testdata.IssueMaxVersion, utl.TestChainID, @@ -425,9 +432,9 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestSponsoredTransferFeeApiNegat transfer_utilities.TransferAssetAmount(&suite.BaseSuite, testdata.TransferMaxVersion, utl.TestChainID, assetId, testdata.Sponsor, testdata.RecipientSender) tdmatrix := testdata.GetTransferWithSponsorshipDataNegative(&suite.BaseSuite, sponsoredAssetId, assetId) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableBroadcast(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -435,57 +442,57 @@ func (suite *TransferWithSponsorshipApiTxSuite) TestSponsoredTransferFeeApiNegat //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.BroadcastTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, !waitForTx) + errMsg := caseName + "Broadcast Transfer with Sponsorship tx: " + tx.TxID.String() txIds[name] = &tx.TxID - utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, - utl.GetTestcaseNameWithVersion(name, v)) + utl.StatusCodesCheck(suite.T(), http.StatusInternalServerError, http.StatusBadRequest, tx, errMsg) utl.ErrorMessageCheck(suite.T(), td.TransferTestData.Expected.ErrBrdCstGoMsg, td.TransferTestData.Expected.ErrBrdCstScalaMsg, tx.BrdCstErr.ErrorBrdCstGo, - tx.BrdCstErr.ErrorBrdCstScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.BrdCstErr.ErrorBrdCstScala, errMsg) //Balances of RecipientSender do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Recipient do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Sponsor do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } - //actualTxIds should be empty - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + //actualTxIds should be empty + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestTransferWithSponsorshipApiTxSuite(t *testing.T) { diff --git a/itests/transfer_with_sponsorship_test.go b/itests/transfer_with_sponsorship_test.go index c328bc529..8f7ad91c2 100644 --- a/itests/transfer_with_sponsorship_test.go +++ b/itests/transfer_with_sponsorship_test.go @@ -40,12 +40,14 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipPositive tdmatrix := testdata.GetSponsoredTransferPositiveData(&suite.BaseSuite, assetId, sponsoredAssetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances(&suite.BaseSuite, td, v, waitForTx) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + errMsg := caseName + "Transfer with Sponsorship: " + tx.TxID.String() + + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) //RecipientSender balance in Waves does not change because of fee in sponsored asset //RecipientSender balance of tokens (waves) is reduced by the amount of tokens that transferred to Recipient @@ -53,42 +55,41 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipPositive utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Recipient balance in Waves changes if Waves were transferred //Recipient Asset balance increases by the asset amount being transferred utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor Asset balance increases by amount of fee in sponsored asset that was used by RecipientSender utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) - + errMsg) }) } } @@ -110,50 +111,51 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipToOnesel tdmatrix := testdata.GetSposoredTransferBySponsorAsSender(&suite.BaseSuite, sponsoredAssetId, assetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor transfers assets to himself, sponsored asset is used as fee asset tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td, v, waitForTx) + errMsg := caseName + "Transfer with Sponsorship: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor asset balance does not change utl.WavesDiffBalanceCheck(suite.T(), td.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -180,7 +182,8 @@ func (suite *TransferWithSponsorshipTxSuite) TestFeeInWavesAccordingMinSponsored sponsoredAssetId, assetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableSend(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -189,8 +192,9 @@ func (suite *TransferWithSponsorshipTxSuite) TestFeeInWavesAccordingMinSponsored tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, waitForTx) - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + errMsg := caseName + "Transfer with Sponsorship: " + tx.TxID.String() + + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) //RecipientSender balance in Waves does not change because of fee in sponsored asset //RecipientSender balance of tokens (waves) is reduced by the amount of tokens that transferred to Recipient @@ -198,41 +202,41 @@ func (suite *TransferWithSponsorshipTxSuite) TestFeeInWavesAccordingMinSponsored utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Recipient balance in Waves changes if Waves were transferred //Recipient Asset balance increases by the asset amount being transferred utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor Asset balance increases by amount of fee in sponsored asset that was used by RecipientSender utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -261,7 +265,8 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipMaxValue tdmatrix := testdata.GetTransferWithSponsorshipMaxAmountPositive(&suite.BaseSuite, sponsoredAssetId, assetId) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableSend(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -269,9 +274,9 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipMaxValue //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, waitForTx) + errMsg := caseName + "Transfer with Sponsorship: " + tx.TxID.String() - utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, "Transfer with Sponsorship: "+tx.TxID.String(), - utl.GetTestcaseNameWithVersion(name, v)) + utl.TxInfoCheck(suite.T(), tx.WtErr.ErrWtGo, tx.WtErr.ErrWtScala, errMsg) ///RecipientSender balance in Waves does not change because of fee in sponsored asset //RecipientSender balance of tokens (waves) is reduced by the amount of tokens that transferred to Recipient @@ -279,41 +284,41 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipMaxValue utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Recipient balance in Waves changes if Waves were transferred //Recipient Asset balance increases by the asset amount being transferred utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Sponsor balance in Waves decreases by amount feeInWaves = feeInSponsoredAsset × 0,001 / minSponsoredAssetFee //Sponsor Asset balance increases by amount of fee in sponsored asset that was used by RecipientSender utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } } @@ -322,6 +327,8 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipMaxValue func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) + for _, v := range versions { //Sponsor creates a new token sponsoredAssetId := issue_utilities.IssueAssetAmount(&suite.BaseSuite, testdata.IssueMaxVersion, utl.TestChainID, @@ -337,10 +344,10 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipNegative assetId, testdata.Sponsor, testdata.RecipientSender) tdmatrix := testdata.GetTransferWithSponsorshipMaxValuesDataNegative(&suite.BaseSuite, sponsoredAssetId, assetId) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableSend(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -348,60 +355,63 @@ func (suite *TransferWithSponsorshipTxSuite) TestTransferWithSponsorshipNegative //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, !waitForTx) + errMsg := caseName + "Transfer with Sponsorship: " + tx.TxID.String() txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.TransferTestData.Expected.ErrGoMsg, td.TransferTestData.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) //Balances of RecipientSender do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Recipient do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Sponsor do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } - //actualTxIds should be empty - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + //actualTxIds should be empty + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func (suite *TransferWithSponsorshipTxSuite) TestSponsoredTransferFeeNegative() { versions := transfer_utilities.GetVersions(&suite.BaseSuite) waitForTx := true + txIds := make(map[string]*crypto.Digest) + for _, v := range versions { //Sponsor creates a new token sponsoredAssetId := issue_utilities.IssueAssetAmount(&suite.BaseSuite, testdata.IssueMaxVersion, utl.TestChainID, @@ -417,10 +427,10 @@ func (suite *TransferWithSponsorshipTxSuite) TestSponsoredTransferFeeNegative() assetId, testdata.Sponsor, testdata.RecipientSender) tdmatrix := testdata.GetTransferWithSponsorshipDataNegative(&suite.BaseSuite, sponsoredAssetId, assetId) - txIds := make(map[string]*crypto.Digest) for name, td := range tdmatrix { - suite.Run(utl.GetTestcaseNameWithVersion(name, v), func() { + caseName := utl.GetTestcaseNameWithVersion(name, v) + suite.Run(caseName, func() { //Sponsor set up sponsorship for the token sponsor_utilities.SponsorshipEnableSend(&suite.BaseSuite, v, td.TransferTestData.ChainID, sponsoredAssetId, td.MinSponsoredAssetFee) @@ -428,55 +438,56 @@ func (suite *TransferWithSponsorshipTxSuite) TestSponsoredTransferFeeNegative() //RecipientSender transfers assets to Recipient specifying fee in the sponsored asset tx, diffBalances := transfer_utilities.SendTransferTxAndGetBalances( &suite.BaseSuite, td.TransferTestData, v, !waitForTx) + errMsg := caseName + "Transfer with Sponsorship: " + tx.TxID.String() txIds[name] = &tx.TxID utl.ErrorMessageCheck(suite.T(), td.TransferTestData.Expected.ErrGoMsg, td.TransferTestData.Expected.ErrScalaMsg, tx.WtErr.ErrWtGo, - tx.WtErr.ErrWtScala, utl.GetTestcaseNameWithVersion(name, v)) + tx.WtErr.ErrWtScala, errMsg) //Balances of RecipientSender do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSender.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.FeeAssetDiffBalanceSender, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetGo, diffBalances.DiffBalancesSender.DiffBalanceFeeAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Recipient do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesRecipient.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceRecipient, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesRecipient.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) //Balances of Sponsor do not change utl.WavesDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.WavesDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesGo, diffBalances.DiffBalancesSponsor.DiffBalanceWaves.BalanceInWavesScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) utl.AssetDiffBalanceCheck(suite.T(), td.TransferTestData.Expected.AssetDiffBalanceSponsor, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetGo, diffBalances.DiffBalancesSponsor.DiffBalanceAsset.BalanceInAssetScala, - utl.GetTestcaseNameWithVersion(name, v)) + errMsg) }) } - //actualTxIds should be empty - actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) - suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } + //actualTxIds should be empty + actualTxIds := utl.GetTxIdsInBlockchain(&suite.BaseSuite, txIds) + suite.Lenf(actualTxIds, 0, "IDs: %#v", actualTxIds) } func TestTransferWithSponsorshipTxSuite(t *testing.T) {