Skip to content

Commit 29af8dd

Browse files
committed
test: make tests windows compliant
1 parent 24f60d8 commit 29af8dd

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,26 +3011,29 @@ mod tests {
30113011
}
30123012

30133013
#[test]
3014-
fn test_create_wallet_if_not_exists() {
3015-
let miner_seed = vec![1, 1, 1, 1];
3016-
let keychain = Keychain::default(miner_seed.clone());
3017-
let miner_pubkey = keychain.get_pub_key();
3018-
3014+
fn test_create_wallet_from_empty_name_default() {
30193015
let mut config = Config::default();
30203016
config.burnchain.magic_bytes = "T3".as_bytes().into();
3021-
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3022-
config.burnchain.username = Some("user".to_owned());
3023-
config.burnchain.password = Some("12345".to_owned());
3017+
config.burnchain.username = Some(String::from("user"));
3018+
config.burnchain.password = Some(String::from("12345"));
3019+
config.burnchain.peer_host = String::from("127.0.0.1");
30243020

30253021
let mut btcd_controller = BitcoinCoreController::new(config.clone());
30263022
btcd_controller
30273023
.start_bitcoind()
30283024
.expect("bitcoind should be started!");
30293025

3026+
let wallets = BitcoinRPCRequest::list_wallets(&config).unwrap();
3027+
assert_eq!(0, wallets.len());
3028+
30303029
let btc_controller = BitcoinRegtestController::new(config.clone(), None);
30313030
btc_controller
30323031
.create_wallet_if_dne()
30333032
.expect("Wallet should now exists!");
3033+
3034+
let wallets = BitcoinRPCRequest::list_wallets(&config).unwrap();
3035+
assert_eq!(1, wallets.len());
3036+
assert_eq!("".to_owned(), wallets[0]);
30343037
}
30353038

30363039
#[test]
@@ -3042,8 +3045,9 @@ mod tests {
30423045
let mut config = Config::default();
30433046
config.burnchain.magic_bytes = "T3".as_bytes().into();
30443047
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3045-
config.burnchain.username = Some("user".to_owned());
3046-
config.burnchain.password = Some("12345".to_owned());
3048+
config.burnchain.username = Some(String::from("user"));
3049+
config.burnchain.password = Some(String::from("12345"));
3050+
config.burnchain.peer_host = String::from("127.0.0.1");
30473051

30483052
let mut btcd_controller = BitcoinCoreController::new(config.clone());
30493053
btcd_controller
@@ -3069,8 +3073,9 @@ mod tests {
30693073
let mut config = Config::default();
30703074
config.burnchain.magic_bytes = "T3".as_bytes().into();
30713075
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3072-
config.burnchain.username = Some("user".to_owned());
3073-
config.burnchain.password = Some("12345".to_owned());
3076+
config.burnchain.username = Some(String::from("user"));
3077+
config.burnchain.password = Some(String::from("12345"));
3078+
config.burnchain.peer_host = String::from("127.0.0.1");
30743079

30753080
let mut btcd_controller = BitcoinCoreController::new(config.clone());
30763081
btcd_controller
@@ -3098,9 +3103,10 @@ mod tests {
30983103

30993104
let mut config = Config::default();
31003105
config.burnchain.magic_bytes = "T3".as_bytes().into();
3106+
config.burnchain.username = Some(String::from("user"));
3107+
config.burnchain.password = Some(String::from("12345"));
3108+
config.burnchain.peer_host = String::from("127.0.0.1");
31013109
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3102-
config.burnchain.username = Some("user".to_owned());
3103-
config.burnchain.password = Some("12345".to_owned());
31043110

31053111
let mut btcd_controller = BitcoinCoreController::new(config.clone());
31063112
btcd_controller
@@ -3166,10 +3172,11 @@ mod tests {
31663172

31673173
let mut config = Config::default();
31683174
config.burnchain.magic_bytes = "T3".as_bytes().into();
3175+
config.burnchain.username = Some(String::from("user"));
3176+
config.burnchain.password = Some(String::from("12345"));
3177+
config.burnchain.peer_host = String::from("127.0.0.1");
31693178
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3170-
config.burnchain.username = Some("user".to_owned());
3171-
config.burnchain.password = Some("12345".to_owned());
3172-
3179+
31733180
let mut btcd_controller = BitcoinCoreController::new(config.clone());
31743181
btcd_controller
31753182
.start_bitcoind()
@@ -3235,9 +3242,10 @@ mod tests {
32353242

32363243
let mut config = Config::default();
32373244
config.burnchain.magic_bytes = "T3".as_bytes().into();
3245+
config.burnchain.username = Some(String::from("user"));
3246+
config.burnchain.password = Some(String::from("12345"));
3247+
config.burnchain.peer_host = String::from("127.0.0.1");
32383248
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3239-
config.burnchain.username = Some("user".to_owned());
3240-
config.burnchain.password = Some("12345".to_owned());
32413249

32423250
let mut btcd_controller = BitcoinCoreController::new(config.clone());
32433251
btcd_controller
@@ -3312,9 +3320,10 @@ mod tests {
33123320

33133321
let mut config = Config::default();
33143322
config.burnchain.magic_bytes = "T3".as_bytes().into();
3323+
config.burnchain.username = Some(String::from("user"));
3324+
config.burnchain.password = Some(String::from("12345"));
3325+
config.burnchain.peer_host = String::from("127.0.0.1");
33153326
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3316-
config.burnchain.username = Some("user".to_owned());
3317-
config.burnchain.password = Some("12345".to_owned());
33183327

33193328
let mut btcd_controller = BitcoinCoreController::new(config.clone());
33203329
btcd_controller

0 commit comments

Comments
 (0)