aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/wallet_test_fixture.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-04-18 14:54:57 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-04-18 14:57:42 +0200
commitf4eae2d910d9edb3750efec4facbeab161cce593 (patch)
treea01442d5df233ef117344574aa80529b5aded4ec /src/wallet/test/wallet_test_fixture.cpp
parentde39c95c2468cc643a5d5bed9e5dd8cea6a40747 (diff)
downloadbitcoin-f4eae2d910d9edb3750efec4facbeab161cce593.tar.xz
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.cpp28
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 0000000000..8370300963
--- /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();
+}