From 2157a9ac4876c2f50421d0e5ad13be3123ff1201 Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Thu, 31 Mar 2016 12:48:41 +0300 Subject: testnet option, Wallet::balance(), Wallet::unlockedBalance() --- tests/libwallet_api_tests/main.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 841b5df27..d5bdc8d67 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -95,7 +95,7 @@ struct WalletManagerTest : public testing::Test TEST_F(WalletManagerTest, WalletManagerCreatesWallet) { - Bitmonero::Wallet * wallet = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, true); + Bitmonero::Wallet * wallet = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); ASSERT_TRUE(wallet->status() == Bitmonero::Wallet::Status_Ok); ASSERT_TRUE(!wallet->seed().empty()); std::vector words; @@ -112,16 +112,16 @@ TEST_F(WalletManagerTest, WalletManagerCreatesWallet) TEST_F(WalletManagerTest, WalletManagerOpensWallet) { - Bitmonero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, true); + Bitmonero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); std::string seed1 = wallet1->seed(); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Bitmonero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS, true); + Bitmonero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); ASSERT_TRUE(wallet2->status() == Bitmonero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); std::cout << "** seed: " << wallet2->seed() << std::endl; } -/* + TEST_F(WalletManagerTest, WalletManagerChangesPassword) { Bitmonero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); @@ -145,7 +145,7 @@ TEST_F(WalletManagerTest, WalletManagerRecoversWallet) std::string address1 = wallet1->address(); ASSERT_FALSE(address1.empty()); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - deleteWallet(WALLET_NAME); + Utils::deleteWallet(WALLET_NAME); Bitmonero::Wallet * wallet2 = wmgr->recoveryWallet(WALLET_NAME, seed1); ASSERT_TRUE(wallet2->status() == Bitmonero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); @@ -229,22 +229,23 @@ TEST_F(WalletManagerTest, WalletManagerStoresWallet4) ASSERT_TRUE(wallet1->address() == address1); ASSERT_TRUE(wmgr->closeWallet(wallet1)); } -*/ + TEST_F(WalletManagerTest, WalletShowsBalance) { Bitmonero::Wallet * wallet1 = wmgr->openWallet(TESTNET_WALLET_NAME, TESTNET_WALLET_PASS, true); - std::string seed1 = wallet1->seed(); - std::string address1 = wallet1->address(); ASSERT_TRUE(wallet1->balance() > 0); + ASSERT_TRUE(wallet1->unlockedBalance() > 0); uint64_t balance1 = wallet1->balance(); + uint64_t unlockedBalance1 = wallet1->unlockedBalance(); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Bitmonero::Wallet * wallet2 = wmgr->openWallet(TESTNET_WALLET_NAME, TESTNET_WALLET_PASS, true); - ASSERT_TRUE(seed1 == wallet2->seed()); - ASSERT_TRUE(address1 == wallet2->address()); + ASSERT_TRUE(balance1 == wallet2->balance()); + std::cout << "wallet balance: " << wallet2->balance() << std::endl; + ASSERT_TRUE(unlockedBalance1 == wallet2->unlockedBalance()); + std::cout << "wallet unlocked balance: " << wallet2->unlockedBalance() << std::endl; ASSERT_TRUE(wmgr->closeWallet(wallet2)); } -- cgit v1.2.3