diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-03-10 19:43:10 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-03-16 14:27:57 +0300 |
commit | 57d7ffc4d612cdc2095d1f9075eecafaf027e928 (patch) | |
tree | 2ae5fd18efa2283d7c6eb7115420f1447cc3ecca /tests/libwallet_api_tests | |
parent | get_seed() included to interface (diff) | |
download | monero-57d7ffc4d612cdc2095d1f9075eecafaf027e928.tar.xz |
changes in wallet2_api + implemented WalletManager::openWallet
Diffstat (limited to 'tests/libwallet_api_tests')
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 0e28598c8..9f8913c39 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -48,23 +48,27 @@ struct WalletManagerTest : public testing::Test const char * WALLET_NAME = "testwallet"; const char * WALLET_PASS = "password"; + const char * WALLET_LANG = "English"; WalletManagerTest() { + std::cout << __FUNCTION__ << std::endl; wmgr = Bitmonero::WalletManagerFactory::getWalletManager(); - deleteWallet(WALLET_NAME); + //deleteWallet(WALLET_NAME); } ~WalletManagerTest() { + std::cout << __FUNCTION__ << std::endl; deleteWallet(WALLET_NAME); } void deleteWallet(const std::string & walletname) { + std::cout << "** deleting wallet " << std::endl; boost::filesystem::remove(walletname); boost::filesystem::remove(walletname + ".address.txt"); boost::filesystem::remove(walletname + ".keys"); @@ -76,14 +80,30 @@ struct WalletManagerTest : public testing::Test TEST_F(WalletManagerTest, WalletManagerCreatesWallet) { - Bitmonero::Wallet * wallet = wmgr->createWallet(WALLET_NAME, WALLET_PASS, "English"); - EXPECT_TRUE(wallet != nullptr); - EXPECT_TRUE(!wallet->seed().empty()); + 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<std::string> words; std::string seed = wallet->seed(); boost::split(words, seed, boost::is_any_of(" "), boost::token_compress_on); - EXPECT_TRUE(words.size() == 25); + ASSERT_TRUE(words.size() == 25); std::cout << "** seed: " << wallet->seed() << std::endl; + ASSERT_TRUE(wmgr->closeWallet(wallet)); +} + +TEST_F(WalletManagerTest, WalletManagerOpensWallet) +{ + 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); + ASSERT_TRUE(wallet2->status() == Bitmonero::Wallet::Status_Ok); + ASSERT_TRUE(wallet2->seed() == seed1); + std::vector<std::string> words; + std::string seed = wallet2->seed(); + boost::split(words, seed, boost::is_any_of(" "), boost::token_compress_on); + ASSERT_TRUE(words.size() == 25); + std::cout << "** seed: " << wallet2->seed() << std::endl; } int main(int argc, char** argv) |