diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-03-11 17:05:36 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-03-16 14:29:06 +0300 |
commit | 5a4f099540750c5bf9c610b4550bc4e8cf25f176 (patch) | |
tree | 9e8f586eaa91849adbeccb27c37d8283490a4fde /tests/libwallet_api_tests | |
parent | changes in wallet2_api + implemented WalletManager::openWallet (diff) | |
download | monero-5a4f099540750c5bf9c610b4550bc4e8cf25f176.tar.xz |
Wallet::setPassword() method for wallet2_api
Diffstat (limited to 'tests/libwallet_api_tests')
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 9f8913c39..fe6cd556f 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -48,6 +48,7 @@ struct WalletManagerTest : public testing::Test const char * WALLET_NAME = "testwallet"; const char * WALLET_PASS = "password"; + const char * WALLET_PASS2 = "password22"; const char * WALLET_LANG = "English"; @@ -93,19 +94,36 @@ TEST_F(WalletManagerTest, WalletManagerCreatesWallet) 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; } + +TEST_F(WalletManagerTest, WalletManagerChangesPassword) +{ + + Bitmonero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + std::string seed1 = wallet1->seed(); + ASSERT_TRUE(wallet1->setPassword(WALLET_PASS2)); + ASSERT_TRUE(wmgr->closeWallet(wallet1)); + Bitmonero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS2); + ASSERT_TRUE(wallet2->status() == Bitmonero::Wallet::Status_Ok); + ASSERT_TRUE(wallet2->seed() == seed1); + ASSERT_TRUE(wmgr->closeWallet(wallet2)); + Bitmonero::Wallet * wallet3 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); + ASSERT_FALSE(wallet3->status() == Bitmonero::Wallet::Status_Ok); + +} + + + + int main(int argc, char** argv) { //epee::debug::get_set_enable_assert(true, false); |