@@ -3022,26 +3022,29 @@ mod tests {
3022
3022
}
3023
3023
3024
3024
#[ test]
3025
- fn test_create_wallet_if_not_exists ( ) {
3026
- let miner_seed = vec ! [ 1 , 1 , 1 , 1 ] ;
3027
- let keychain = Keychain :: default ( miner_seed. clone ( ) ) ;
3028
- let miner_pubkey = keychain. get_pub_key ( ) ;
3029
-
3025
+ fn test_create_wallet_from_empty_name_default ( ) {
3030
3026
let mut config = Config :: default ( ) ;
3031
3027
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3032
- config. burnchain . local_mining_public_key = Some ( miner_pubkey . to_hex ( ) ) ;
3033
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3034
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3028
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3029
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3030
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3035
3031
3036
3032
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3037
3033
btcd_controller
3038
3034
. start_bitcoind ( )
3039
3035
. expect ( "bitcoind should be started!" ) ;
3040
3036
3037
+ let wallets = BitcoinRPCRequest :: list_wallets ( & config) . unwrap ( ) ;
3038
+ assert_eq ! ( 0 , wallets. len( ) ) ;
3039
+
3041
3040
let btc_controller = BitcoinRegtestController :: new ( config. clone ( ) , None ) ;
3042
3041
btc_controller
3043
3042
. create_wallet_if_dne ( )
3044
3043
. expect ( "Wallet should now exists!" ) ;
3044
+
3045
+ let wallets = BitcoinRPCRequest :: list_wallets ( & config) . unwrap ( ) ;
3046
+ assert_eq ! ( 1 , wallets. len( ) ) ;
3047
+ assert_eq ! ( "" . to_owned( ) , wallets[ 0 ] ) ;
3045
3048
}
3046
3049
3047
3050
#[ test]
@@ -3053,8 +3056,9 @@ mod tests {
3053
3056
let mut config = Config :: default ( ) ;
3054
3057
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3055
3058
config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3056
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3057
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3059
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3060
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3061
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3058
3062
3059
3063
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3060
3064
btcd_controller
@@ -3080,8 +3084,9 @@ mod tests {
3080
3084
let mut config = Config :: default ( ) ;
3081
3085
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3082
3086
config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3083
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3084
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3087
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3088
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3089
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3085
3090
3086
3091
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3087
3092
btcd_controller
@@ -3109,9 +3114,10 @@ mod tests {
3109
3114
3110
3115
let mut config = Config :: default ( ) ;
3111
3116
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3117
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3118
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3119
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3112
3120
config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3113
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3114
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3115
3121
3116
3122
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3117
3123
btcd_controller
@@ -3177,10 +3183,11 @@ mod tests {
3177
3183
3178
3184
let mut config = Config :: default ( ) ;
3179
3185
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3186
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3187
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3188
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3180
3189
config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3181
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3182
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3183
-
3190
+
3184
3191
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3185
3192
btcd_controller
3186
3193
. start_bitcoind ( )
@@ -3246,9 +3253,10 @@ mod tests {
3246
3253
3247
3254
let mut config = Config :: default ( ) ;
3248
3255
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3256
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3257
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3258
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3249
3259
config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3250
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3251
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3252
3260
3253
3261
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3254
3262
btcd_controller
@@ -3323,9 +3331,10 @@ mod tests {
3323
3331
3324
3332
let mut config = Config :: default ( ) ;
3325
3333
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3334
+ config. burnchain . username = Some ( String :: from ( "user" ) ) ;
3335
+ config. burnchain . password = Some ( String :: from ( "12345" ) ) ;
3336
+ config. burnchain . peer_host = String :: from ( "127.0.0.1" ) ;
3326
3337
config. burnchain . local_mining_public_key = Some ( miner_pubkey. to_hex ( ) ) ;
3327
- config. burnchain . username = Some ( "user" . to_owned ( ) ) ;
3328
- config. burnchain . password = Some ( "12345" . to_owned ( ) ) ;
3329
3338
3330
3339
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3331
3340
btcd_controller
0 commit comments