MCPcopy Create free account
hub / github.com/ElementsProject/elements / InitWalletDirTestingSetup

Method InitWalletDirTestingSetup

src/wallet/test/init_test_fixture.cpp:16–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15namespace wallet {
16InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
17{
18 m_wallet_loader = MakeWalletLoader(*m_node.chain, *Assert(m_node.args));
19
20 std::string sep;
21 sep += fs::path::preferred_separator;
22
23 m_datadir = gArgs.GetDataDirNet();
24 m_cwd = fs::current_path();
25
26 m_walletdir_path_cases["default"] = m_datadir / "wallets";
27 m_walletdir_path_cases["custom"] = m_datadir / "my_wallets";
28 m_walletdir_path_cases["nonexistent"] = m_datadir / "path_does_not_exist";
29 m_walletdir_path_cases["file"] = m_datadir / "not_a_directory.dat";
30 m_walletdir_path_cases["trailing"] = m_datadir / ("wallets" + sep);
31 m_walletdir_path_cases["trailing2"] = m_datadir / ("wallets" + sep + sep);
32
33 fs::current_path(m_datadir);
34 m_walletdir_path_cases["relative"] = "wallets";
35
36 fs::create_directories(m_walletdir_path_cases["default"]);
37 fs::create_directories(m_walletdir_path_cases["custom"]);
38 fs::create_directories(m_walletdir_path_cases["relative"]);
39 std::ofstream f{m_walletdir_path_cases["file"]};
40 f.close();
41}
42
43InitWalletDirTestingSetup::~InitWalletDirTestingSetup()
44{

Callers

nothing calls this directly

Calls 3

create_directoriesFunction · 0.85
MakeWalletLoaderFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected