@@ -3,9 +3,8 @@ use std::process::{Command, Stdio};
3
3
use assert_cmd:: prelude:: * ;
4
4
use ntest:: timeout;
5
5
use predicates:: str:: contains;
6
- use serde_json:: Value ;
7
6
use utilities:: {
8
- create_vault_client, read_secret_as_json , vault_container, write_string_to_tempfile,
7
+ create_vault_client, read_vault_secret , vault_container, write_string_to_tempfile,
9
8
} ;
10
9
11
10
#[ tokio:: test]
@@ -50,14 +49,14 @@ vault:
50
49
) ) ;
51
50
52
51
let vault_client = create_vault_client ( vault_host. to_string ( ) . as_str ( ) , vault_port) ;
53
- let json_secret = read_secret_as_json ( & vault_client, "init/vault/new/path" ) . await ;
52
+ let vault_secret = read_vault_secret ( & vault_client, "init/vault/new/path" ) . await ;
54
53
55
- assert_json_value_equals ( & json_secret , " postgresql_active_user" , "TBD" ) ;
56
- assert_json_value_equals ( & json_secret , " postgresql_active_user_password" , "TBD" ) ;
57
- assert_json_value_equals ( & json_secret , " postgresql_user_1" , "TBD" ) ;
58
- assert_json_value_equals ( & json_secret , " postgresql_user_1_password" , "TBD" ) ;
59
- assert_json_value_equals ( & json_secret , " postgresql_user_2" , "TBD" ) ;
60
- assert_json_value_equals ( & json_secret , " postgresql_user_2_password" , "TBD" ) ;
54
+ assert_eq ! ( vault_secret . postgresql_active_user, "TBD" ) ;
55
+ assert_eq ! ( vault_secret . postgresql_active_user_password, "TBD" ) ;
56
+ assert_eq ! ( vault_secret . postgresql_user_1, "TBD" ) ;
57
+ assert_eq ! ( vault_secret . postgresql_user_1_password, "TBD" ) ;
58
+ assert_eq ! ( vault_secret . postgresql_user_2, "TBD" ) ;
59
+ assert_eq ! ( vault_secret . postgresql_user_2_password, "TBD" ) ;
61
60
}
62
61
63
62
#[ tokio:: test]
@@ -80,12 +79,3 @@ async fn init_vault_invalid_url() {
80
79
. stderr ( contains ( "Failed to create initial Vault structure" ) )
81
80
. stderr ( contains ( "error sending request for url" ) ) ;
82
81
}
83
-
84
- fn assert_json_value_equals ( json : & Value , key : & str , value : & str ) {
85
- assert_eq ! (
86
- json[ key]
87
- . as_str( )
88
- . expect( format!( "Failed to read key '{}' in JSON" , key) . as_str( ) ) ,
89
- value
90
- ) ;
91
- }
0 commit comments