@@ -3011,26 +3011,29 @@ mod tests {
3011
3011
}
3012
3012
3013
3013
#[ 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 ( ) {
3019
3015
let mut config = Config :: default ( ) ;
3020
3016
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" ) ;
3024
3020
3025
3021
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3026
3022
btcd_controller
3027
3023
. start_bitcoind ( )
3028
3024
. expect ( "bitcoind should be started!" ) ;
3029
3025
3026
+ let wallets = BitcoinRPCRequest :: list_wallets ( & config) . unwrap ( ) ;
3027
+ assert_eq ! ( 0 , wallets. len( ) ) ;
3028
+
3030
3029
let btc_controller = BitcoinRegtestController :: new ( config. clone ( ) , None ) ;
3031
3030
btc_controller
3032
3031
. create_wallet_if_dne ( )
3033
3032
. 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 ] ) ;
3034
3037
}
3035
3038
3036
3039
#[ test]
@@ -3042,8 +3045,9 @@ mod tests {
3042
3045
let mut config = Config :: default ( ) ;
3043
3046
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3044
3047
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" ) ;
3047
3051
3048
3052
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3049
3053
btcd_controller
@@ -3069,8 +3073,9 @@ mod tests {
3069
3073
let mut config = Config :: default ( ) ;
3070
3074
config. burnchain . magic_bytes = "T3" . as_bytes ( ) . into ( ) ;
3071
3075
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" ) ;
3074
3079
3075
3080
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3076
3081
btcd_controller
@@ -3098,9 +3103,10 @@ mod tests {
3098
3103
3099
3104
let mut config = Config :: default ( ) ;
3100
3105
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" ) ;
3101
3109
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 ( ) ) ;
3104
3110
3105
3111
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3106
3112
btcd_controller
@@ -3166,10 +3172,11 @@ mod tests {
3166
3172
3167
3173
let mut config = Config :: default ( ) ;
3168
3174
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" ) ;
3169
3178
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
+
3173
3180
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3174
3181
btcd_controller
3175
3182
. start_bitcoind ( )
@@ -3235,9 +3242,10 @@ mod tests {
3235
3242
3236
3243
let mut config = Config :: default ( ) ;
3237
3244
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" ) ;
3238
3248
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 ( ) ) ;
3241
3249
3242
3250
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3243
3251
btcd_controller
@@ -3312,9 +3320,10 @@ mod tests {
3312
3320
3313
3321
let mut config = Config :: default ( ) ;
3314
3322
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" ) ;
3315
3326
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 ( ) ) ;
3318
3327
3319
3328
let mut btcd_controller = BitcoinCoreController :: new ( config. clone ( ) ) ;
3320
3329
btcd_controller
0 commit comments