From f1f9279d90bd912695307384eac92bf098e092d6 Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Sun, 21 Feb 2016 21:18:16 +0300 Subject: get_seed() included to interface --- tests/libwallet_api_tests/main.cpp | 43 ++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'tests/libwallet_api_tests') diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index ab3bba40a..0e28598c8 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -30,7 +30,14 @@ #include "gtest/gtest.h" #include "wallet/wallet2_api.h" +#include +#include +#include +#include + + +using namespace std; //unsigned int epee::g_test_dbg_lock_sleep = 0; @@ -39,26 +46,44 @@ struct WalletManagerTest : public testing::Test { Bitmonero::WalletManager * wmgr; + const char * WALLET_NAME = "testwallet"; + const char * WALLET_PASS = "password"; + + WalletManagerTest() { wmgr = Bitmonero::WalletManagerFactory::getWalletManager(); + deleteWallet(WALLET_NAME); } -}; + ~WalletManagerTest() + { + deleteWallet(WALLET_NAME); + } -TEST(WalletFactoryTest, WalletFactoryReturnsWalletManager) -{ - Bitmonero::WalletManager * wmgr = Bitmonero::WalletManagerFactory::getWalletManager(); - EXPECT_NE(wmgr, nullptr); -} + + void deleteWallet(const std::string & walletname) + { + boost::filesystem::remove(walletname); + boost::filesystem::remove(walletname + ".address.txt"); + boost::filesystem::remove(walletname + ".keys"); + } + +}; -TEST_F(WalletManagerTest, WalletManagerReturnsCreatesWallet) +TEST_F(WalletManagerTest, WalletManagerCreatesWallet) { - Bitmonero::Wallet * wallet = wmgr->createWallet("test_wallet", "password", "en_US"); - EXPECT_TRUE(wallet != nullptr); + Bitmonero::Wallet * wallet = wmgr->createWallet(WALLET_NAME, WALLET_PASS, "English"); + EXPECT_TRUE(wallet != nullptr); + EXPECT_TRUE(!wallet->seed().empty()); + std::vector words; + std::string seed = wallet->seed(); + boost::split(words, seed, boost::is_any_of(" "), boost::token_compress_on); + EXPECT_TRUE(words.size() == 25); + std::cout << "** seed: " << wallet->seed() << std::endl; } int main(int argc, char** argv) -- cgit v1.2.3