@@ -46,7 +46,10 @@ impl ResolverTester {
4646#[ tokio:: test( flavor = "multi_thread" ) ]
4747async fn if_single_static_provider_with_no_key_to_resolve_is_valid ( ) -> anyhow:: Result < ( ) > {
4848 let resolver = ResolverTester :: new ( )
49- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
49+ . with_provider ( StaticProvider :: with_variable (
50+ "database_host" ,
51+ Some ( "localhost" ) ,
52+ ) )
5053 . make_resolver ( ) ?;
5154
5255 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -58,8 +61,11 @@ async fn if_single_static_provider_with_no_key_to_resolve_is_valid() -> anyhow::
5861async fn if_single_static_provider_has_data_for_variable_key_to_resolve_it_succeeds (
5962) -> anyhow:: Result < ( ) > {
6063 let resolver = ResolverTester :: new ( )
61- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
62- . with_variable ( "foo" , None )
64+ . with_provider ( StaticProvider :: with_variable (
65+ "database_host" ,
66+ Some ( "localhost" ) ,
67+ ) )
68+ . with_variable ( "database_host" , None )
6369 . make_resolver ( ) ?;
6470
6571 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -71,8 +77,11 @@ async fn if_single_static_provider_has_data_for_variable_key_to_resolve_it_succe
7177async fn if_there_is_a_single_static_provider_and_it_does_not_contain_a_required_variable_then_validation_fails (
7278) -> anyhow:: Result < ( ) > {
7379 let resolver = ResolverTester :: new ( )
74- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
75- . with_variable ( "bar" , None )
80+ . with_provider ( StaticProvider :: with_variable (
81+ "database_host" ,
82+ Some ( "localhost" ) ,
83+ ) )
84+ . with_variable ( "api_key" , None )
7685 . make_resolver ( ) ?;
7786
7887 assert ! ( resolver. ensure_required_variables_resolved( ) . await . is_err( ) ) ;
@@ -85,7 +94,7 @@ async fn if_there_is_a_dynamic_provider_then_validation_succeeds_even_without_de
8594) -> anyhow:: Result < ( ) > {
8695 let resolver = ResolverTester :: new ( )
8796 . with_provider ( DynamicProvider )
88- . with_variable ( "bar " , None )
97+ . with_variable ( "api_key " , None )
8998 . make_resolver ( ) ?;
9099
91100 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -98,8 +107,11 @@ async fn if_there_is_a_dynamic_provider_and_static_provider_but_the_variable_to_
98107) -> anyhow:: Result < ( ) > {
99108 let resolver = ResolverTester :: new ( )
100109 . with_provider ( DynamicProvider )
101- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
102- . with_variable ( "baz" , None )
110+ . with_provider ( StaticProvider :: with_variable (
111+ "database_host" ,
112+ Some ( "localhost" ) ,
113+ ) )
114+ . with_variable ( "api_key" , None )
103115 . make_resolver ( ) ?;
104116
105117 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -112,8 +124,11 @@ async fn if_there_is_a_dynamic_provider_and_a_static_provider_then_validation_su
112124) -> anyhow:: Result < ( ) > {
113125 let resolver = ResolverTester :: new ( )
114126 . with_provider ( DynamicProvider )
115- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
116- . with_variable ( "baz" , Some ( "coo" ) )
127+ . with_provider ( StaticProvider :: with_variable (
128+ "database_host" ,
129+ Some ( "localhost" ) ,
130+ ) )
131+ . with_variable ( "api_key" , Some ( "super-secret-key" ) )
117132 . make_resolver ( ) ?;
118133
119134 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -124,9 +139,15 @@ async fn if_there_is_a_dynamic_provider_and_a_static_provider_then_validation_su
124139#[ tokio:: test( flavor = "multi_thread" ) ]
125140async fn if_there_are_two_static_providers_where_one_has_data_is_valid ( ) -> anyhow:: Result < ( ) > {
126141 let resolver = ResolverTester :: new ( )
127- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
128- . with_provider ( StaticProvider :: with_variable ( "baz" , Some ( "hay" ) ) )
129- . with_variable ( "foo" , None )
142+ . with_provider ( StaticProvider :: with_variable (
143+ "database_host" ,
144+ Some ( "localhost" ) ,
145+ ) )
146+ . with_provider ( StaticProvider :: with_variable (
147+ "api_key" ,
148+ Some ( "super-secret-key" ) ,
149+ ) )
150+ . with_variable ( "database_host" , None )
130151 . make_resolver ( ) ?;
131152
132153 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -140,9 +161,15 @@ async fn if_there_are_two_static_providers_where_one_has_data_is_valid() -> anyh
140161async fn if_there_are_two_static_providers_where_first_provider_does_not_have_data_while_second_provider_does (
141162) -> anyhow:: Result < ( ) > {
142163 let resolver = ResolverTester :: new ( )
143- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
144- . with_provider ( StaticProvider :: with_variable ( "baz" , Some ( "hay" ) ) )
145- . with_variable ( "baz" , None )
164+ . with_provider ( StaticProvider :: with_variable (
165+ "database_host" ,
166+ Some ( "localhost" ) ,
167+ ) )
168+ . with_provider ( StaticProvider :: with_variable (
169+ "api_key" ,
170+ Some ( "super-secret-key" ) ,
171+ ) )
172+ . with_variable ( "api_key" , None )
146173 . make_resolver ( ) ?;
147174
148175 resolver. ensure_required_variables_resolved ( ) . await ?;
@@ -153,8 +180,14 @@ async fn if_there_are_two_static_providers_where_first_provider_does_not_have_da
153180#[ tokio:: test( flavor = "multi_thread" ) ]
154181async fn if_there_is_two_static_providers_neither_having_data_is_invalid ( ) -> anyhow:: Result < ( ) > {
155182 let resolver = ResolverTester :: new ( )
156- . with_provider ( StaticProvider :: with_variable ( "foo" , Some ( "bar" ) ) )
157- . with_provider ( StaticProvider :: with_variable ( "baz" , Some ( "hay" ) ) )
183+ . with_provider ( StaticProvider :: with_variable (
184+ "database_host" ,
185+ Some ( "localhost" ) ,
186+ ) )
187+ . with_provider ( StaticProvider :: with_variable (
188+ "api_key" ,
189+ Some ( "super-secret-key" ) ,
190+ ) )
158191 . with_variable ( "hello" , None )
159192 . make_resolver ( ) ?;
160193
@@ -167,7 +200,7 @@ async fn if_there_is_two_static_providers_neither_having_data_is_invalid() -> an
167200async fn no_provider_data_available_but_variable_default_value_needed_is_invalid (
168201) -> anyhow:: Result < ( ) > {
169202 let resolver = ResolverTester :: new ( )
170- . with_variable ( "hello " , None )
203+ . with_variable ( "api_key " , None )
171204 . make_resolver ( ) ?;
172205
173206 assert ! ( resolver. ensure_required_variables_resolved( ) . await . is_err( ) ) ;
@@ -179,7 +212,7 @@ async fn no_provider_data_available_but_variable_default_value_needed_is_invalid
179212async fn no_provider_data_available_but_variable_has_default_value_needed_is_valid (
180213) -> anyhow:: Result < ( ) > {
181214 let resolver = ResolverTester :: new ( )
182- . with_variable ( "hello " , Some ( "World " ) )
215+ . with_variable ( "api_key " , Some ( "super-secret-key " ) )
183216 . make_resolver ( ) ?;
184217
185218 resolver. ensure_required_variables_resolved ( ) . await ?;
0 commit comments