@@ -22,10 +22,7 @@ async fn test_fetch_with_network_policy_enforcement() -> Result<()> {
2222
2323 let target_url = "https://example.com/" ;
2424
25- println ! (
26- "Attempting to fetch {} without network permissions..." ,
27- target_url
28- ) ;
25+ println ! ( "Attempting to fetch {target_url} without network permissions..." ) ;
2926
3027 let result = manager
3128 . execute_component_call (
@@ -37,23 +34,19 @@ async fn test_fetch_with_network_policy_enforcement() -> Result<()> {
3734
3835 match result {
3936 Ok ( response) => {
40- println ! ( "Component response: {}" , response ) ;
37+ println ! ( "Component response: {response}" ) ;
4138
4239 // Check if the response contains an error indicating the request was blocked
4340 if response. contains ( "HttpRequestDenied" ) {
4441 println ! ( "✅ Network request properly blocked by policy!" ) ;
4542 } else {
4643 panic ! (
47- "Expected network request to be blocked, but got successful response: {}" ,
48- response
44+ "Expected network request to be blocked, but got successful response: {response}"
4945 ) ;
5046 }
5147 }
5248 Err ( e) => {
53- panic ! (
54- "Expected network request to be blocked, but got successful response: {}" ,
55- e
56- ) ;
49+ panic ! ( "Expected network request to be blocked, but got successful response: {e}" ) ;
5750 }
5851 }
5952
@@ -70,10 +63,7 @@ async fn test_fetch_with_network_policy_enforcement() -> Result<()> {
7063 assert ! ( grant_result. is_ok( ) , "Failed to grant network permission" ) ;
7164
7265 // Then try to fetch with network permissions - should succeed
73- println ! (
74- "Attempting to fetch {} with network permissions..." ,
75- target_url
76- ) ;
66+ println ! ( "Attempting to fetch {target_url} with network permissions..." ) ;
7767
7868 let result = manager
7969 . execute_component_call (
@@ -85,27 +75,20 @@ async fn test_fetch_with_network_policy_enforcement() -> Result<()> {
8575
8676 match result {
8777 Ok ( response) => {
88- println ! ( "Fetch response after granting permission: {}" , response ) ;
78+ println ! ( "Fetch response after granting permission: {response}" ) ;
8979
9080 if response. contains ( "HttpRequestDenied" ) {
91- panic ! (
92- "Network request still being blocked after granting permission: {}" ,
93- response
94- ) ;
81+ panic ! ( "Network request still being blocked after granting permission: {response}" ) ;
9582 } else {
9683 assert ! (
9784 response. contains( "Example Domain" ) || response. contains( "example" ) ,
98- "Expected response to contain example.com content, got: {}" ,
99- response
85+ "Expected response to contain example.com content, got: {response}"
10086 ) ;
10187 println ! ( "✅ Network request succeeded after granting permission!" ) ;
10288 }
10389 }
10490 Err ( e) => {
105- panic ! (
106- "Expected network request to be blocked, but got successful response: {}" ,
107- e
108- ) ;
91+ panic ! ( "Expected network request to be blocked, but got successful response: {e}" ) ;
10992 }
11093 }
11194
@@ -142,13 +125,13 @@ async fn test_fetch_with_different_host_still_denied() -> Result<()> {
142125
143126 match result {
144127 Err ( e) => {
145- panic ! ( "Expected request to httpbin.org to be denied when only example.com is allowed, got: {}" , e ) ;
128+ panic ! ( "Expected request to httpbin.org to be denied when only example.com is allowed, got: {e}" ) ;
146129 }
147130 Ok ( response) => {
148131 if response. contains ( "HttpRequestDenied" ) {
149132 println ! ( "✅ Request to unauthorized host properly blocked!" ) ;
150133 } else {
151- panic ! ( "Expected request to httpbin.org to be denied when only example.com is allowed, got: {}" , response ) ;
134+ panic ! ( "Expected request to httpbin.org to be denied when only example.com is allowed, got: {response}" ) ;
152135 }
153136 }
154137 }
@@ -186,13 +169,10 @@ async fn test_fetch_with_scheme_specific_permissions() -> Result<()> {
186169 // HTTPS should succeed or fail for non-policy reasons
187170 match https_result {
188171 Ok ( response) => {
189- println ! ( "HTTPS fetch response: {}" , response ) ;
172+ println ! ( "HTTPS fetch response: {response}" ) ;
190173
191174 if response. contains ( "HttpRequestDenied" ) {
192- panic ! (
193- "HTTPS request should not be blocked by policy, got: {}" ,
194- response
195- ) ;
175+ panic ! ( "HTTPS request should not be blocked by policy, got: {response}" ) ;
196176 } else {
197177 println ! ( "✅ HTTPS request allowed as expected" ) ;
198178 }
@@ -203,8 +183,7 @@ async fn test_fetch_with_scheme_specific_permissions() -> Result<()> {
203183 !error_msg. contains( "denied" )
204184 && !error_msg. contains( "HttpRequestUriInvalid" )
205185 && !error_msg. contains( "HttpRequestDenied" ) ,
206- "HTTPS request should not be denied by policy: {}" ,
207- error_msg
186+ "HTTPS request should not be denied by policy: {error_msg}"
208187 ) ;
209188 }
210189 }
@@ -221,21 +200,19 @@ async fn test_fetch_with_scheme_specific_permissions() -> Result<()> {
221200 match http_result {
222201 Err ( e) => {
223202 let error_msg = e. to_string ( ) ;
224- println ! ( "Expected HTTP denial: {}" , error_msg ) ;
203+ println ! ( "Expected HTTP denial: {error_msg}" ) ;
225204
226205 assert ! (
227206 error_msg. contains( "HttpRequestDenied" ) ,
228- "Expected HTTP request to be denied when only HTTPS is allowed: {}" ,
229- error_msg
207+ "Expected HTTP request to be denied when only HTTPS is allowed: {error_msg}"
230208 ) ;
231209 }
232210 Ok ( response) => {
233211 if response. contains ( "HttpRequestDenied" ) {
234212 println ! ( "✅ HTTP request properly blocked when only HTTPS allowed!" ) ;
235213 } else {
236214 panic ! (
237- "Expected HTTP request to be denied when only HTTPS is allowed, got: {}" ,
238- response
215+ "Expected HTTP request to be denied when only HTTPS is allowed, got: {response}"
239216 ) ;
240217 }
241218 }
0 commit comments