diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-04-18 14:54:57 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-04-18 14:57:42 +0200 |
| commit | f4eae2d910d9edb3750efec4facbeab161cce593 (patch) | |
| tree | a01442d5df233ef117344574aa80529b5aded4ec /src/wallet/test/wallet_test_fixture.cpp | |
| parent | test: move accounting_tests and rpc_wallet_tests to wallet/test (diff) | |
| download | discoin-f4eae2d910d9edb3750efec4facbeab161cce593.tar.xz discoin-f4eae2d910d9edb3750efec4facbeab161cce593.zip | |
test: Create test fixture for wallet
Removes all the `#ifdef ENABLE_WALLET` from `test_bitcoin` by
making the wallet tests use their own fixture.
Diffstat (limited to 'src/wallet/test/wallet_test_fixture.cpp')
| -rw-r--r-- | src/wallet/test/wallet_test_fixture.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp new file mode 100644 index 000000000..837030096 --- /dev/null +++ b/src/wallet/test/wallet_test_fixture.cpp @@ -0,0 +1,28 @@ +#include "wallet/test/wallet_test_fixture.h" + +#include "rpc/server.h" +#include "wallet/db.h" +#include "wallet/wallet.h" + +WalletTestingSetup::WalletTestingSetup(const std::string& chainName): + TestingSetup(chainName) +{ + bitdb.MakeMock(); + + bool fFirstRun; + pwalletMain = new CWallet("wallet.dat"); + pwalletMain->LoadWallet(fFirstRun); + RegisterValidationInterface(pwalletMain); + + RegisterWalletRPCCommands(tableRPC); +} + +WalletTestingSetup::~WalletTestingSetup() +{ + UnregisterValidationInterface(pwalletMain); + delete pwalletMain; + pwalletMain = NULL; + + bitdb.Flush(true); + bitdb.Reset(); +} |