mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
test: Create test fixture for wallet
Removes all the `#ifdef ENABLE_WALLET` from `test_bitcoin` by making the wallet tests use their own fixture.
This commit is contained in:
parent
de39c95c24
commit
f4eae2d910
8 changed files with 55 additions and 31 deletions
28
src/wallet/test/wallet_test_fixture.cpp
Normal file
28
src/wallet/test/wallet_test_fixture.cpp
Normal file
|
|
@ -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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue