diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-02-21 21:18:16 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-03-16 14:27:57 +0300 |
commit | f1f9279d90bd912695307384eac92bf098e092d6 (patch) | |
tree | 2cbc0faa18bdeabbd15961586885e317f9a121f8 /tests/libwallet_api_tests | |
parent | tests for wallet2_api (diff) | |
download | monero-f1f9279d90bd912695307384eac92bf098e092d6.tar.xz |
get_seed() included to interface
Diffstat (limited to 'tests/libwallet_api_tests')
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
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 <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> +#include <iostream> +#include <vector> + + +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<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); + std::cout << "** seed: " << wallet->seed() << std::endl; } int main(int argc, char** argv) |