[fabric][tests]fix test case error
aitos-io#1359
@@ -643,14 +643,20 @@ START_TEST(test_005Transaction_0026TxQuery_Failure_Walleturl_Err)
}
END_TEST
-START_TEST(test_005Transaction_0027TxQuery_Failure_WalletHostName_Err)
+START_TEST(test_005Transaction_0027TxQuery_Success_WalletHostName_Err)
{
BSINT32 rtnVal;
BoatHlfabricTx tx_ptr;
BoatHlfabricWallet *g_fabric_wallet_ptr = NULL;
g_fabric_wallet_ptr = fabric_get_wallet_ptr();
- g_fabric_wallet_ptr->network_info.nodesCfg.orderCfg.endorser[0].hostName = "peer0.org1.com111";
+ BoatFree(g_fabric_wallet_ptr->network_info.nodesCfg.orderCfg.endorser[0].hostName);
+ g_fabric_wallet_ptr->network_info.nodesCfg.orderCfg.endorser[0].hostName = NULL;
+
+ BCHAR *fabric_demo_order1_hostName_err = "peer0.org1.com111";
+ g_fabric_wallet_ptr->network_info.nodesCfg.orderCfg.endorser[0].hostName = BoatMalloc(strlen(fabric_demo_order1_hostName_err) + 1);
+ strcpy(g_fabric_wallet_ptr->network_info.nodesCfg.orderCfg.endorser[0].hostName, fabric_demo_order1_hostName_err);
+
rtnVal = BoatHlfabricTxInit(&tx_ptr, g_fabric_wallet_ptr, NULL, "mycc", NULL, "mychannel", "Org1MSP");
ck_assert_int_eq(rtnVal, BOAT_SUCCESS);
@@ -661,7 +667,7 @@ START_TEST(test_005Transaction_0027TxQuery_Failure_WalletHostName_Err)
rtnVal = BoatHlfabricTxSetArgs(&tx_ptr, "query", "a", NULL);
ck_assert_int_eq(rtnVal, BOAT_SUCCESS);
rtnVal = BoatHlfabricTxSubmit(&tx_ptr);
- ck_assert_int_eq(rtnVal, BOAT_ERROR);
+ ck_assert_int_eq(rtnVal, BOAT_SUCCESS);
BoatHlfabricTxDeInit(&tx_ptr);
BoatIotSdkDeInit();
}
@@ -714,7 +720,7 @@ Suite *make_fabricTransactionTest_suite(void)
tcase_add_test(tc_transaction_api, test_005Transaction_0024TxQuery_Failure_Args_channelId_err);
tcase_add_test(tc_transaction_api, test_005Transaction_0025TxQuery_Failure_Args_orgName_err);
tcase_add_test(tc_transaction_api, test_005Transaction_0026TxQuery_Failure_Walleturl_Err);
- tcase_add_test(tc_transaction_api, test_005Transaction_0027TxQuery_Failure_WalletHostName_Err);
+ tcase_add_test(tc_transaction_api, test_005Transaction_0027TxQuery_Success_WalletHostName_Err);
tcase_add_test(tc_transaction_api, test_005Transaction_0028DeInit_Txptr_NULL);
return s_transaction;
