upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjk <email@jkrause.io>2024-01-31 15:13:52 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-02-02 07:21:01 +0000
commitab1450c655f7fdfc214e1556d16fc754ca684613 (patch)
tree9ded305354a272d411059493e9475a3e39ff5cae /tests
parentccdbc337ae16d7c70be44166269c8b2d5b9f5c09 (diff)
test: replace block_on with tokio::tests
This is intended to improve the reliabilty of the tests. there have been particular issues with random tests never ending when run in the nix configuration see discussion here https://github.com/DanConwayDev/ngit-cli/issues/ 6#issuecomment-1918971239 and: https://github.com/DanConwayDev/ngit-cli/pull/7
Diffstat (limited to 'tests')
-rw-r--r--tests/claim.rs81
-rw-r--r--tests/login.rs185
-rw-r--r--tests/prs_create.rs127
-rw-r--r--tests/prs_list.rs85
-rw-r--r--tests/pull.rs30
-rw-r--r--tests/push.rs34
6 files changed, 278 insertions, 264 deletions
diff --git a/tests/claim.rs b/tests/claim.rs
index 93feb54..ef669d0 100644
--- a/tests/claim.rs
+++ b/tests/claim.rs
@@ -117,10 +117,10 @@ mod when_repo_not_previously_claimed {
117 mod sent_to_correct_relays { 117 mod sent_to_correct_relays {
118 use super::*; 118 use super::*;
119 119
120 #[test] 120 #[tokio::test]
121 #[serial] 121 #[serial]
122 fn only_1_repository_kind_event_sent_to_user_relays() -> Result<()> { 122 async fn only_1_repository_kind_event_sent_to_user_relays() -> Result<()> {
123 let (_, _, r53, r55, _) = futures::executor::block_on(prep_run_claim())?; 123 let (_, _, r53, r55, _) = prep_run_claim().await?;
124 for relay in [&r53, &r55] { 124 for relay in [&r53, &r55] {
125 assert_eq!( 125 assert_eq!(
126 relay 126 relay
@@ -134,10 +134,10 @@ mod when_repo_not_previously_claimed {
134 Ok(()) 134 Ok(())
135 } 135 }
136 136
137 #[test] 137 #[tokio::test]
138 #[serial] 138 #[serial]
139 fn only_1_repository_kind_event_sent_to_specified_repo_relays() -> Result<()> { 139 async fn only_1_repository_kind_event_sent_to_specified_repo_relays() -> Result<()> {
140 let (_, _, _, r55, r56) = futures::executor::block_on(prep_run_claim())?; 140 let (_, _, _, r55, r56) = prep_run_claim().await?;
141 for relay in [&r55, &r56] { 141 for relay in [&r55, &r56] {
142 assert_eq!( 142 assert_eq!(
143 relay 143 relay
@@ -151,10 +151,10 @@ mod when_repo_not_previously_claimed {
151 Ok(()) 151 Ok(())
152 } 152 }
153 153
154 #[test] 154 #[tokio::test]
155 #[serial] 155 #[serial]
156 fn event_not_sent_to_fallback_relay() -> Result<()> { 156 async fn event_not_sent_to_fallback_relay() -> Result<()> {
157 let (r51, r52, _, _, _) = futures::executor::block_on(prep_run_claim())?; 157 let (r51, r52, _, _, _) = prep_run_claim().await?;
158 for relay in [&r51, &r52] { 158 for relay in [&r51, &r52] {
159 assert_eq!( 159 assert_eq!(
160 relay 160 relay
@@ -241,10 +241,10 @@ mod when_repo_not_previously_claimed {
241 Ok(()) 241 Ok(())
242 } 242 }
243 243
244 #[test] 244 #[tokio::test]
245 #[serial] 245 #[serial]
246 fn contains_maintainers_and_relays() -> Result<()> { 246 async fn contains_maintainers_and_relays() -> Result<()> {
247 futures::executor::block_on(async_run_test())?; 247 async_run_test().await?;
248 Ok(()) 248 Ok(())
249 } 249 }
250 } 250 }
@@ -252,9 +252,10 @@ mod when_repo_not_previously_claimed {
252 mod tags { 252 mod tags {
253 use super::*; 253 use super::*;
254 254
255 #[test] 255 #[tokio::test]
256 #[serial] 256 #[serial]
257 fn d_replaceable_event_identifier_defaults_to_root_commit_id_shorthand() -> Result<()> { 257 async fn d_replaceable_event_identifier_defaults_to_root_commit_id_shorthand()
258 -> Result<()> {
258 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 259 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?;
259 for relay in [&r53, &r55, &r56] { 260 for relay in [&r53, &r55, &r56] {
260 let event: &nostr::Event = relay 261 let event: &nostr::Event = relay
@@ -273,10 +274,10 @@ mod when_repo_not_previously_claimed {
273 Ok(()) 274 Ok(())
274 } 275 }
275 276
276 #[test] 277 #[tokio::test]
277 #[serial] 278 #[serial]
278 fn root_commit_as_reference() -> Result<()> { 279 async fn root_commit_as_reference() -> Result<()> {
279 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 280 let (_, _, r53, r55, r56) = prep_run_claim().await?;
280 for relay in [&r53, &r55, &r56] { 281 for relay in [&r53, &r55, &r56] {
281 let event: &nostr::Event = relay 282 let event: &nostr::Event = relay
282 .events 283 .events
@@ -290,10 +291,10 @@ mod when_repo_not_previously_claimed {
290 Ok(()) 291 Ok(())
291 } 292 }
292 293
293 #[test] 294 #[tokio::test]
294 #[serial] 295 #[serial]
295 fn name() -> Result<()> { 296 async fn name() -> Result<()> {
296 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 297 let (_, _, r53, r55, r56) = prep_run_claim().await?;
297 for relay in [&r53, &r55, &r56] { 298 for relay in [&r53, &r55, &r56] {
298 let event: &nostr::Event = relay 299 let event: &nostr::Event = relay
299 .events 300 .events
@@ -311,10 +312,10 @@ mod when_repo_not_previously_claimed {
311 Ok(()) 312 Ok(())
312 } 313 }
313 314
314 #[test] 315 #[tokio::test]
315 #[serial] 316 #[serial]
316 fn description() -> Result<()> { 317 async fn description() -> Result<()> {
317 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 318 let (_, _, r53, r55, r56) = prep_run_claim().await?;
318 for relay in [&r53, &r55, &r56] { 319 for relay in [&r53, &r55, &r56] {
319 let event: &nostr::Event = relay 320 let event: &nostr::Event = relay
320 .events 321 .events
@@ -328,10 +329,10 @@ mod when_repo_not_previously_claimed {
328 Ok(()) 329 Ok(())
329 } 330 }
330 331
331 #[test] 332 #[tokio::test]
332 #[serial] 333 #[serial]
333 fn git_server() -> Result<()> { 334 async fn git_server() -> Result<()> {
334 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 335 let (_, _, r53, r55, r56) = prep_run_claim().await?;
335 for relay in [&r53, &r55, &r56] { 336 for relay in [&r53, &r55, &r56] {
336 let event: &nostr::Event = relay 337 let event: &nostr::Event = relay
337 .events 338 .events
@@ -347,10 +348,10 @@ mod when_repo_not_previously_claimed {
347 Ok(()) 348 Ok(())
348 } 349 }
349 350
350 #[test] 351 #[tokio::test]
351 #[serial] 352 #[serial]
352 fn relays() -> Result<()> { 353 async fn relays() -> Result<()> {
353 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 354 let (_, _, r53, r55, r56) = prep_run_claim().await?;
354 for relay in [&r53, &r55, &r56] { 355 for relay in [&r53, &r55, &r56] {
355 let event: &nostr::Event = relay 356 let event: &nostr::Event = relay
356 .events 357 .events
@@ -369,9 +370,9 @@ mod when_repo_not_previously_claimed {
369 Ok(()) 370 Ok(())
370 } 371 }
371 372
372 #[test] 373 #[tokio::test]
373 #[serial] 374 #[serial]
374 fn web() -> Result<()> { 375 async fn web() -> Result<()> {
375 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?; 376 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_claim())?;
376 for relay in [&r53, &r55, &r56] { 377 for relay in [&r53, &r55, &r56] {
377 let event: &nostr::Event = relay 378 let event: &nostr::Event = relay
@@ -473,10 +474,10 @@ mod when_repo_not_previously_claimed {
473 Ok(()) 474 Ok(())
474 } 475 }
475 476
476 #[test] 477 #[tokio::test]
477 #[serial] 478 #[serial]
478 fn check_cli_output() -> Result<()> { 479 async fn check_cli_output() -> Result<()> {
479 futures::executor::block_on(run_test_async())?; 480 run_test_async().await?;
480 Ok(()) 481 Ok(())
481 } 482 }
482 } 483 }
@@ -572,10 +573,10 @@ mod when_repo_not_previously_claimed {
572 mod tags { 573 mod tags {
573 use super::*; 574 use super::*;
574 575
575 #[test] 576 #[tokio::test]
576 #[serial] 577 #[serial]
577 fn relays_match_user_write_relays() -> Result<()> { 578 async fn relays_match_user_write_relays() -> Result<()> {
578 let (_, _, r53, r55, _) = futures::executor::block_on(prep_run_claim())?; 579 let (_, _, r53, r55, _) = prep_run_claim().await?;
579 for relay in [&r53, &r55] { 580 for relay in [&r53, &r55] {
580 let event: &nostr::Event = relay 581 let event: &nostr::Event = relay
581 .events 582 .events
@@ -650,10 +651,10 @@ mod when_repo_not_previously_claimed {
650 Ok(()) 651 Ok(())
651 } 652 }
652 653
653 #[test] 654 #[tokio::test]
654 #[serial] 655 #[serial]
655 fn check_cli_output() -> Result<()> { 656 async fn check_cli_output() -> Result<()> {
656 futures::executor::block_on(run_test_async())?; 657 run_test_async().await?;
657 Ok(()) 658 Ok(())
658 } 659 }
659 } 660 }
diff --git a/tests/login.rs b/tests/login.rs
index ee7450d..7fc9356 100644
--- a/tests/login.rs
+++ b/tests/login.rs
@@ -121,10 +121,10 @@ mod with_relays {
121 Ok(()) 121 Ok(())
122 } 122 }
123 123
124 #[test] 124 #[tokio::test]
125 #[serial] 125 #[serial]
126 fn when_latest_metadata_and_relay_list_on_all_relays() -> Result<()> { 126 async fn when_latest_metadata_and_relay_list_on_all_relays() -> Result<()> {
127 futures::executor::block_on(run_test_displays_correct_name( 127 run_test_displays_correct_name(
128 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 128 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
129 relay.respond_events( 129 relay.respond_events(
130 client_id, 130 client_id,
@@ -147,16 +147,17 @@ mod with_relays {
147 )?; 147 )?;
148 Ok(()) 148 Ok(())
149 }), 149 }),
150 )) 150 )
151 .await
151 } 152 }
152 153
153 mod poorly_quality_metadata_event { 154 mod poorly_quality_metadata_event {
154 use super::*; 155 use super::*;
155 156
156 #[test] 157 #[tokio::test]
157 #[serial] 158 #[serial]
158 fn when_metadata_contains_only_display_name() -> Result<()> { 159 async fn when_metadata_contains_only_display_name() -> Result<()> {
159 futures::executor::block_on(run_test_displays_correct_name( 160 run_test_displays_correct_name(
160 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 161 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
161 relay.respond_events( 162 relay.respond_events(
162 client_id, 163 client_id,
@@ -173,12 +174,13 @@ mod with_relays {
173 Ok(()) 174 Ok(())
174 }), 175 }),
175 None, 176 None,
176 )) 177 )
178 .await
177 } 179 }
178 180
179 #[test] 181 #[tokio::test]
180 #[serial] 182 #[serial]
181 fn when_metadata_contains_only_displayname() -> Result<()> { 183 async fn when_metadata_contains_only_displayname() -> Result<()> {
182 println!( 184 println!(
183 "displayName: {}", 185 "displayName: {}",
184 nostr::Metadata::new() 186 nostr::Metadata::new()
@@ -192,7 +194,7 @@ mod with_relays {
192 nostr::Metadata::new().name("fred").name.unwrap() 194 nostr::Metadata::new().name("fred").name.unwrap()
193 ); 195 );
194 196
195 futures::executor::block_on(run_test_displays_correct_name( 197 run_test_displays_correct_name(
196 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 198 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
197 relay.respond_events( 199 relay.respond_events(
198 client_id, 200 client_id,
@@ -210,12 +212,13 @@ mod with_relays {
210 Ok(()) 212 Ok(())
211 }), 213 }),
212 None, 214 None,
213 )) 215 )
216 .await
214 } 217 }
215 218
216 #[test] 219 #[tokio::test]
217 #[serial] 220 #[serial]
218 fn displays_npub_when_metadata_contains_no_name_displayname_or_display_name() 221 async fn displays_npub_when_metadata_contains_no_name_displayname_or_display_name()
219 -> Result<()> { 222 -> Result<()> {
220 println!( 223 println!(
221 "displayName: {}", 224 "displayName: {}",
@@ -230,7 +233,7 @@ mod with_relays {
230 nostr::Metadata::new().name("fred").name.unwrap() 233 nostr::Metadata::new().name("fred").name.unwrap()
231 ); 234 );
232 235
233 futures::executor::block_on(run_test_displays_fallback_to_npub( 236 run_test_displays_fallback_to_npub(
234 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 237 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
235 relay.respond_events( 238 relay.respond_events(
236 client_id, 239 client_id,
@@ -247,15 +250,16 @@ mod with_relays {
247 Ok(()) 250 Ok(())
248 }), 251 }),
249 None, 252 None,
250 )) 253 )
254 .await
251 } 255 }
252 } 256 }
253 257
254 #[test] 258 #[tokio::test]
255 #[serial] 259 #[serial]
256 fn when_latest_metadata_and_relay_list_on_some_relays_but_others_have_none() 260 async fn when_latest_metadata_and_relay_list_on_some_relays_but_others_have_none()
257 -> Result<()> { 261 -> Result<()> {
258 futures::executor::block_on(run_test_displays_correct_name( 262 run_test_displays_correct_name(
259 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 263 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
260 relay.respond_events( 264 relay.respond_events(
261 client_id, 265 client_id,
@@ -268,13 +272,15 @@ mod with_relays {
268 Ok(()) 272 Ok(())
269 }), 273 }),
270 None, 274 None,
271 )) 275 )
276 .await
272 } 277 }
273 278
274 #[test] 279 #[tokio::test]
275 #[serial] 280 #[serial]
276 fn when_latest_metadata_only_on_relay_and_relay_list_on_another() -> Result<()> { 281 async fn when_latest_metadata_only_on_relay_and_relay_list_on_another() -> Result<()>
277 futures::executor::block_on(run_test_displays_correct_name( 282 {
283 run_test_displays_correct_name(
278 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 284 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
279 relay.respond_events( 285 relay.respond_events(
280 client_id, 286 client_id,
@@ -291,13 +297,14 @@ mod with_relays {
291 )?; 297 )?;
292 Ok(()) 298 Ok(())
293 }), 299 }),
294 )) 300 )
301 .await
295 } 302 }
296 303
297 #[test] 304 #[tokio::test]
298 #[serial] 305 #[serial]
299 fn when_some_relays_return_old_metadata_event() -> Result<()> { 306 async fn when_some_relays_return_old_metadata_event() -> Result<()> {
300 futures::executor::block_on(run_test_displays_correct_name( 307 run_test_displays_correct_name(
301 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 308 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
302 relay.respond_events( 309 relay.respond_events(
303 client_id, 310 client_id,
@@ -317,13 +324,14 @@ mod with_relays {
317 )?; 324 )?;
318 Ok(()) 325 Ok(())
319 }), 326 }),
320 )) 327 )
328 .await
321 } 329 }
322 330
323 #[test] 331 #[tokio::test]
324 #[serial] 332 #[serial]
325 fn when_some_relays_return_other_users_metadata() -> Result<()> { 333 async fn when_some_relays_return_other_users_metadata() -> Result<()> {
326 futures::executor::block_on(run_test_displays_correct_name( 334 run_test_displays_correct_name(
327 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 335 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
328 relay.respond_events( 336 relay.respond_events(
329 client_id, 337 client_id,
@@ -343,13 +351,14 @@ mod with_relays {
343 )?; 351 )?;
344 Ok(()) 352 Ok(())
345 }), 353 }),
346 )) 354 )
355 .await
347 } 356 }
348 357
349 #[test] 358 #[tokio::test]
350 #[serial] 359 #[serial]
351 fn when_some_relays_return_other_event_kinds() -> Result<()> { 360 async fn when_some_relays_return_other_event_kinds() -> Result<()> {
352 futures::executor::block_on(run_test_displays_correct_name( 361 run_test_displays_correct_name(
353 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 362 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
354 let event = generate_test_key_1_kind_event(nostr::Kind::TextNote); 363 let event = generate_test_key_1_kind_event(nostr::Kind::TextNote);
355 relay.respond_events( 364 relay.respond_events(
@@ -370,31 +379,31 @@ mod with_relays {
370 )?; 379 )?;
371 Ok(()) 380 Ok(())
372 }), 381 }),
373 )) 382 )
383 .await
374 } 384 }
375 385
376 mod when_specifying_command_line_nsec_only { 386 mod when_specifying_command_line_nsec_only {
377 use super::*; 387 use super::*;
378 388
379 #[test] 389 #[tokio::test]
380 #[serial] 390 #[serial]
381 fn displays_correct_name() -> Result<()> { 391 async fn displays_correct_name() -> Result<()> {
382 futures::executor::block_on( 392 run_test_when_specifying_command_line_nsec_only_displays_correct_name(
383 run_test_when_specifying_command_line_nsec_only_displays_correct_name( 393 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
384 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 394 relay.respond_events(
385 relay.respond_events( 395 client_id,
386 client_id, 396 &subscription_id,
387 &subscription_id, 397 &vec![
388 &vec![ 398 generate_test_key_1_metadata_event("fred"),
389 generate_test_key_1_metadata_event("fred"), 399 generate_test_key_1_relay_list_event_same_as_fallback(),
390 generate_test_key_1_relay_list_event_same_as_fallback(), 400 ],
391 ], 401 )?;
392 )?; 402 Ok(())
393 Ok(()) 403 }),
394 }), 404 None,
395 None,
396 ),
397 ) 405 )
406 .await
398 } 407 }
399 async fn run_test_when_specifying_command_line_nsec_only_displays_correct_name( 408 async fn run_test_when_specifying_command_line_nsec_only_displays_correct_name(
400 relay_listener1: Option<ListenerReqFunc<'_>>, 409 relay_listener1: Option<ListenerReqFunc<'_>>,
@@ -430,10 +439,9 @@ mod with_relays {
430 mod when_specifying_command_line_password_only { 439 mod when_specifying_command_line_password_only {
431 use super::*; 440 use super::*;
432 441
433 #[test] 442 #[tokio::test]
434 #[serial] 443 #[serial]
435 fn displays_correct_name() -> Result<()> { 444 async fn displays_correct_name() -> Result<()> {
436 futures::executor::block_on(
437 run_test_when_specifying_command_line_password_only_displays_correct_name( 445 run_test_when_specifying_command_line_password_only_displays_correct_name(
438 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 446 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
439 relay.respond_events( 447 relay.respond_events(
@@ -447,8 +455,8 @@ mod with_relays {
447 Ok(()) 455 Ok(())
448 }), 456 }),
449 None, 457 None,
450 ), 458 )
451 ) 459 .await
452 } 460 }
453 async fn run_test_when_specifying_command_line_password_only_displays_correct_name( 461 async fn run_test_when_specifying_command_line_password_only_displays_correct_name(
454 relay_listener1: Option<ListenerReqFunc<'_>>, 462 relay_listener1: Option<ListenerReqFunc<'_>>,
@@ -495,10 +503,9 @@ mod with_relays {
495 mod when_specifying_command_line_nsec_and_password { 503 mod when_specifying_command_line_nsec_and_password {
496 use super::*; 504 use super::*;
497 505
498 #[test] 506 #[tokio::test]
499 #[serial] 507 #[serial]
500 fn displays_correct_name() -> Result<()> { 508 async fn displays_correct_name() -> Result<()> {
501 futures::executor::block_on(
502 run_test_when_specifying_command_line_nsec_and_password_displays_correct_name( 509 run_test_when_specifying_command_line_nsec_and_password_displays_correct_name(
503 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 510 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
504 relay.respond_events( 511 relay.respond_events(
@@ -512,8 +519,7 @@ mod with_relays {
512 Ok(()) 519 Ok(())
513 }), 520 }),
514 None, 521 None,
515 ), 522 ).await
516 )
517 } 523 }
518 async fn run_test_when_specifying_command_line_nsec_and_password_displays_correct_name( 524 async fn run_test_when_specifying_command_line_nsec_and_password_displays_correct_name(
519 relay_listener1: Option<ListenerReqFunc<'_>>, 525 relay_listener1: Option<ListenerReqFunc<'_>>,
@@ -557,12 +563,10 @@ mod with_relays {
557 mod when_no_metadata_found { 563 mod when_no_metadata_found {
558 use super::*; 564 use super::*;
559 565
560 #[test] 566 #[tokio::test]
561 #[serial] 567 #[serial]
562 fn warm_user_and_displays_npub() -> Result<()> { 568 async fn warm_user_and_displays_npub() -> Result<()> {
563 futures::executor::block_on( 569 run_test_when_no_metadata_found_warns_user_and_uses_npub(None, None).await
564 run_test_when_no_metadata_found_warns_user_and_uses_npub(None, None),
565 )
566 } 570 }
567 571
568 async fn run_test_when_no_metadata_found_warns_user_and_uses_npub( 572 async fn run_test_when_no_metadata_found_warns_user_and_uses_npub(
@@ -612,22 +616,21 @@ mod with_relays {
612 mod when_metadata_but_no_relay_list_found { 616 mod when_metadata_but_no_relay_list_found {
613 use super::*; 617 use super::*;
614 618
615 #[test] 619 #[tokio::test]
616 #[serial] 620 #[serial]
617 fn warm_user_and_displays_name() -> Result<()> { 621 async fn warm_user_and_displays_name() -> Result<()> {
618 futures::executor::block_on( 622 run_test_when_no_relay_list_found_warns_user_and_uses_npub(
619 run_test_when_no_relay_list_found_warns_user_and_uses_npub( 623 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
620 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 624 relay.respond_events(
621 relay.respond_events( 625 client_id,
622 client_id, 626 &subscription_id,
623 &subscription_id, 627 &vec![generate_test_key_1_metadata_event("fred")],
624 &vec![generate_test_key_1_metadata_event("fred")], 628 )?;
625 )?; 629 Ok(())
626 Ok(()) 630 }),
627 }), 631 None,
628 None,
629 ),
630 ) 632 )
633 .await
631 } 634 }
632 635
633 async fn run_test_when_no_relay_list_found_warns_user_and_uses_npub( 636 async fn run_test_when_no_relay_list_found_warns_user_and_uses_npub(
@@ -682,10 +685,10 @@ mod with_relays {
682 mod uses_cache { 685 mod uses_cache {
683 use super::*; 686 use super::*;
684 687
685 #[test] 688 #[tokio::test]
686 #[serial] 689 #[serial]
687 fn dislays_logged_in_with_correct_name() -> Result<()> { 690 async fn dislays_logged_in_with_correct_name() -> Result<()> {
688 futures::executor::block_on(run_test_dislays_logged_in_with_correct_name(Some( 691 run_test_dislays_logged_in_with_correct_name(Some(
689 &|relay, client_id, subscription_id, _| -> Result<()> { 692 &|relay, client_id, subscription_id, _| -> Result<()> {
690 relay.respond_events( 693 relay.respond_events(
691 client_id, 694 client_id,
@@ -697,7 +700,8 @@ mod with_relays {
697 )?; 700 )?;
698 Ok(()) 701 Ok(())
699 }, 702 },
700 ))) 703 ))
704 .await
701 } 705 }
702 async fn run_test_dislays_logged_in_with_correct_name( 706 async fn run_test_dislays_logged_in_with_correct_name(
703 relay_listener: Option<ListenerReqFunc<'_>>, 707 relay_listener: Option<ListenerReqFunc<'_>>,
@@ -794,10 +798,10 @@ mod with_relays {
794 } 798 }
795 799
796 /// this also tests that additional relays are queried 800 /// this also tests that additional relays are queried
797 #[test] 801 #[tokio::test]
798 #[serial] 802 #[serial]
799 fn displays_correct_name() -> Result<()> { 803 async fn displays_correct_name() -> Result<()> {
800 futures::executor::block_on(run_test_displays_correct_name( 804 run_test_displays_correct_name(
801 Some(&|relay, client_id, subscription_id, _| -> Result<()> { 805 Some(&|relay, client_id, subscription_id, _| -> Result<()> {
802 relay.respond_events( 806 relay.respond_events(
803 client_id, 807 client_id,
@@ -820,7 +824,8 @@ mod with_relays {
820 )?; 824 )?;
821 Ok(()) 825 Ok(())
822 }), 826 }),
823 )) 827 )
828 .await
824 } 829 }
825 } 830 }
826 } 831 }
diff --git a/tests/prs_create.rs b/tests/prs_create.rs
index ca92ac2..4f71e5a 100644
--- a/tests/prs_create.rs
+++ b/tests/prs_create.rs
@@ -252,10 +252,10 @@ mod sends_pr_and_2_patches_to_3_relays {
252 Ok((r51, r52, r53, r55, r56)) 252 Ok((r51, r52, r53, r55, r56))
253 } 253 }
254 254
255 #[test] 255 #[tokio::test]
256 #[serial] 256 #[serial]
257 fn only_1_pr_kind_event_sent_to_each_relay() -> Result<()> { 257 async fn only_1_pr_kind_event_sent_to_each_relay() -> Result<()> {
258 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 258 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
259 for relay in [&r53, &r55, &r56] { 259 for relay in [&r53, &r55, &r56] {
260 assert_eq!( 260 assert_eq!(
261 relay 261 relay
@@ -269,10 +269,10 @@ mod sends_pr_and_2_patches_to_3_relays {
269 Ok(()) 269 Ok(())
270 } 270 }
271 271
272 #[test] 272 #[tokio::test]
273 #[serial] 273 #[serial]
274 fn only_1_pr_kind_event_sent_to_user_relays() -> Result<()> { 274 async fn only_1_pr_kind_event_sent_to_user_relays() -> Result<()> {
275 let (_, _, r53, r55, _) = futures::executor::block_on(prep_run_create_pr())?; 275 let (_, _, r53, r55, _) = prep_run_create_pr().await?;
276 for relay in [&r53, &r55] { 276 for relay in [&r53, &r55] {
277 assert_eq!( 277 assert_eq!(
278 relay 278 relay
@@ -286,10 +286,10 @@ mod sends_pr_and_2_patches_to_3_relays {
286 Ok(()) 286 Ok(())
287 } 287 }
288 288
289 #[test] 289 #[tokio::test]
290 #[serial] 290 #[serial]
291 fn only_1_pr_kind_event_sent_to_repo_relays() -> Result<()> { 291 async fn only_1_pr_kind_event_sent_to_repo_relays() -> Result<()> {
292 let (_, _, _, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 292 let (_, _, _, r55, r56) = prep_run_create_pr().await?;
293 for relay in [&r55, &r56] { 293 for relay in [&r55, &r56] {
294 assert_eq!( 294 assert_eq!(
295 relay 295 relay
@@ -303,10 +303,10 @@ mod sends_pr_and_2_patches_to_3_relays {
303 Ok(()) 303 Ok(())
304 } 304 }
305 305
306 #[test] 306 #[tokio::test]
307 #[serial] 307 #[serial]
308 fn pr_not_sent_to_fallback_relay() -> Result<()> { 308 async fn pr_not_sent_to_fallback_relay() -> Result<()> {
309 let (r51, r52, _, _, _) = futures::executor::block_on(prep_run_create_pr())?; 309 let (r51, r52, _, _, _) = prep_run_create_pr().await?;
310 for relay in [&r51, &r52] { 310 for relay in [&r51, &r52] {
311 assert_eq!( 311 assert_eq!(
312 relay 312 relay
@@ -320,10 +320,10 @@ mod sends_pr_and_2_patches_to_3_relays {
320 Ok(()) 320 Ok(())
321 } 321 }
322 322
323 #[test] 323 #[tokio::test]
324 #[serial] 324 #[serial]
325 fn only_2_patch_kind_events_sent_to_each_relay() -> Result<()> { 325 async fn only_2_patch_kind_events_sent_to_each_relay() -> Result<()> {
326 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 326 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
327 for relay in [&r53, &r55, &r56] { 327 for relay in [&r53, &r55, &r56] {
328 assert_eq!( 328 assert_eq!(
329 relay 329 relay
@@ -337,10 +337,10 @@ mod sends_pr_and_2_patches_to_3_relays {
337 Ok(()) 337 Ok(())
338 } 338 }
339 339
340 #[test] 340 #[tokio::test]
341 #[serial] 341 #[serial]
342 fn patch_content_contains_patch_in_email_format() -> Result<()> { 342 async fn patch_content_contains_patch_in_email_format() -> Result<()> {
343 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 343 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
344 for relay in [&r53, &r55, &r56] { 344 for relay in [&r53, &r55, &r56] {
345 let patch_events: Vec<&nostr::Event> = relay 345 let patch_events: Vec<&nostr::Event> = relay
346 .events 346 .events
@@ -407,10 +407,10 @@ mod sends_pr_and_2_patches_to_3_relays {
407 mod pr_tags { 407 mod pr_tags {
408 use super::*; 408 use super::*;
409 409
410 #[test] 410 #[tokio::test]
411 #[serial] 411 #[serial]
412 fn pr_tags_repo_commit() -> Result<()> { 412 async fn pr_tags_repo_commit() -> Result<()> {
413 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 413 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
414 let root_commit = GitTestRepo::default().initial_commit()?; 414 let root_commit = GitTestRepo::default().initial_commit()?;
415 415
416 for relay in [&r53, &r55, &r56] { 416 for relay in [&r53, &r55, &r56] {
@@ -429,10 +429,10 @@ mod sends_pr_and_2_patches_to_3_relays {
429 Ok(()) 429 Ok(())
430 } 430 }
431 431
432 #[test] 432 #[tokio::test]
433 #[serial] 433 #[serial]
434 fn pr_tags_title_as_name() -> Result<()> { 434 async fn pr_tags_title_as_name() -> Result<()> {
435 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 435 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
436 for relay in [&r53, &r55, &r56] { 436 for relay in [&r53, &r55, &r56] {
437 let pr_event: &nostr::Event = relay 437 let pr_event: &nostr::Event = relay
438 .events 438 .events
@@ -453,10 +453,10 @@ mod sends_pr_and_2_patches_to_3_relays {
453 Ok(()) 453 Ok(())
454 } 454 }
455 455
456 #[test] 456 #[tokio::test]
457 #[serial] 457 #[serial]
458 fn pr_tags_description() -> Result<()> { 458 async fn pr_tags_description() -> Result<()> {
459 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 459 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
460 for relay in [&r53, &r55, &r56] { 460 for relay in [&r53, &r55, &r56] {
461 let pr_event: &nostr::Event = relay 461 let pr_event: &nostr::Event = relay
462 .events 462 .events
@@ -477,10 +477,10 @@ mod sends_pr_and_2_patches_to_3_relays {
477 Ok(()) 477 Ok(())
478 } 478 }
479 479
480 #[test] 480 #[tokio::test]
481 #[serial] 481 #[serial]
482 fn pr_tags_branch_name() -> Result<()> { 482 async fn pr_tags_branch_name() -> Result<()> {
483 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 483 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
484 for relay in [&r53, &r55, &r56] { 484 for relay in [&r53, &r55, &r56] {
485 let pr_event: &nostr::Event = relay 485 let pr_event: &nostr::Event = relay
486 .events 486 .events
@@ -506,8 +506,8 @@ mod sends_pr_and_2_patches_to_3_relays {
506 mod patch_tags { 506 mod patch_tags {
507 use super::*; 507 use super::*;
508 508
509 fn prep() -> Result<nostr::Event> { 509 async fn prep() -> Result<nostr::Event> {
510 let (_, _, r53, _, _) = futures::executor::block_on(prep_run_create_pr())?; 510 let (_, _, r53, _, _) = prep_run_create_pr().await?;
511 Ok(r53 511 Ok(r53
512 .events 512 .events
513 .iter() 513 .iter()
@@ -516,11 +516,11 @@ mod sends_pr_and_2_patches_to_3_relays {
516 .clone()) 516 .clone())
517 } 517 }
518 518
519 #[test] 519 #[tokio::test]
520 #[serial] 520 #[serial]
521 fn commit_and_commit_r() -> Result<()> { 521 async fn commit_and_commit_r() -> Result<()> {
522 static COMMIT_ID: &str = "fe973a840fba2a8ab37dd505c154854a69a6505c"; 522 static COMMIT_ID: &str = "fe973a840fba2a8ab37dd505c154854a69a6505c";
523 let most_recent_patch = prep()?; 523 let most_recent_patch = prep().await?;
524 assert!( 524 assert!(
525 most_recent_patch 525 most_recent_patch
526 .tags 526 .tags
@@ -536,12 +536,12 @@ mod sends_pr_and_2_patches_to_3_relays {
536 Ok(()) 536 Ok(())
537 } 537 }
538 538
539 #[test] 539 #[tokio::test]
540 #[serial] 540 #[serial]
541 fn parent_commit() -> Result<()> { 541 async fn parent_commit() -> Result<()> {
542 // commit parent 'r' and 'parent-commit' tag 542 // commit parent 'r' and 'parent-commit' tag
543 static COMMIT_PARENT_ID: &str = "232efb37ebc67692c9e9ff58b83c0d3d63971a0a"; 543 static COMMIT_PARENT_ID: &str = "232efb37ebc67692c9e9ff58b83c0d3d63971a0a";
544 let most_recent_patch = prep()?; 544 let most_recent_patch = prep().await?;
545 assert!( 545 assert!(
546 most_recent_patch.tags.iter().any( 546 most_recent_patch.tags.iter().any(
547 |t| t.as_vec()[0].eq("parent-commit") && t.as_vec()[1].eq(COMMIT_PARENT_ID) 547 |t| t.as_vec()[0].eq("parent-commit") && t.as_vec()[1].eq(COMMIT_PARENT_ID)
@@ -550,19 +550,20 @@ mod sends_pr_and_2_patches_to_3_relays {
550 Ok(()) 550 Ok(())
551 } 551 }
552 552
553 #[test] 553 #[tokio::test]
554 #[serial] 554 #[serial]
555 fn root_commit_as_r() -> Result<()> { 555 async fn root_commit_as_r() -> Result<()> {
556 assert!(prep()?.tags.iter().any(|t| t.as_vec()[0].eq("r") 556 assert!(prep().await?.tags.iter().any(|t| t.as_vec()[0].eq("r")
557 && t.as_vec()[1].eq("9ee507fc4357d7ee16a5d8901bedcd103f23c17d"))); 557 && t.as_vec()[1].eq("9ee507fc4357d7ee16a5d8901bedcd103f23c17d")));
558 Ok(()) 558 Ok(())
559 } 559 }
560 560
561 #[test] 561 #[tokio::test]
562 #[serial] 562 #[serial]
563 fn description_with_commit_message() -> Result<()> { 563 async fn description_with_commit_message() -> Result<()> {
564 assert_eq!( 564 assert_eq!(
565 prep()? 565 prep()
566 .await?
566 .tags 567 .tags
567 .iter() 568 .iter()
568 .find(|t| t.as_vec()[0].eq("description")) 569 .find(|t| t.as_vec()[0].eq("description"))
@@ -573,11 +574,12 @@ mod sends_pr_and_2_patches_to_3_relays {
573 Ok(()) 574 Ok(())
574 } 575 }
575 576
576 #[test] 577 #[tokio::test]
577 #[serial] 578 #[serial]
578 fn commit_author() -> Result<()> { 579 async fn commit_author() -> Result<()> {
579 assert_eq!( 580 assert_eq!(
580 prep()? 581 prep()
582 .await?
581 .tags 583 .tags
582 .iter() 584 .iter()
583 .find(|t| t.as_vec()[0].eq("author")) 585 .find(|t| t.as_vec()[0].eq("author"))
@@ -588,11 +590,12 @@ mod sends_pr_and_2_patches_to_3_relays {
588 Ok(()) 590 Ok(())
589 } 591 }
590 592
591 #[test] 593 #[tokio::test]
592 #[serial] 594 #[serial]
593 fn commit_committer() -> Result<()> { 595 async fn commit_committer() -> Result<()> {
594 assert_eq!( 596 assert_eq!(
595 prep()? 597 prep()
598 .await?
596 .tags 599 .tags
597 .iter() 600 .iter()
598 .find(|t| t.as_vec()[0].eq("committer")) 601 .find(|t| t.as_vec()[0].eq("committer"))
@@ -603,10 +606,10 @@ mod sends_pr_and_2_patches_to_3_relays {
603 Ok(()) 606 Ok(())
604 } 607 }
605 608
606 #[test] 609 #[tokio::test]
607 #[serial] 610 #[serial]
608 fn patch_tags_pr_event_as_root() -> Result<()> { 611 async fn patch_tags_pr_event_as_root() -> Result<()> {
609 let (_, _, r53, r55, r56) = futures::executor::block_on(prep_run_create_pr())?; 612 let (_, _, r53, r55, r56) = prep_run_create_pr().await?;
610 for relay in [&r53, &r55, &r56] { 613 for relay in [&r53, &r55, &r56] {
611 let patch_events: Vec<&nostr::Event> = relay 614 let patch_events: Vec<&nostr::Event> = relay
612 .events 615 .events
@@ -705,10 +708,10 @@ mod sends_pr_and_2_patches_to_3_relays {
705 Ok(()) 708 Ok(())
706 } 709 }
707 710
708 #[test] 711 #[tokio::test]
709 #[serial] 712 #[serial]
710 fn check_cli_output() -> Result<()> { 713 async fn check_cli_output() -> Result<()> {
711 futures::executor::block_on(run_test_async())?; 714 run_test_async().await?;
712 Ok(()) 715 Ok(())
713 } 716 }
714 } 717 }
@@ -787,10 +790,10 @@ mod sends_pr_and_2_patches_to_3_relays {
787 Ok(()) 790 Ok(())
788 } 791 }
789 792
790 #[test] 793 #[tokio::test]
791 #[serial] 794 #[serial]
792 fn only_first_rejected_event_sent_to_relay() -> Result<()> { 795 async fn only_first_rejected_event_sent_to_relay() -> Result<()> {
793 futures::executor::block_on(run_test_async())?; 796 run_test_async().await?;
794 Ok(()) 797 Ok(())
795 } 798 }
796 } 799 }
@@ -879,10 +882,10 @@ mod sends_pr_and_2_patches_to_3_relays {
879 Ok((r51, r52, r53)) 882 Ok((r51, r52, r53))
880 } 883 }
881 884
882 #[test] 885 #[tokio::test]
883 #[serial] 886 #[serial]
884 fn cli_show_rejection_with_comment() -> Result<()> { 887 async fn cli_show_rejection_with_comment() -> Result<()> {
885 futures::executor::block_on(run_test_async())?; 888 run_test_async().await?;
886 Ok(()) 889 Ok(())
887 } 890 }
888 } 891 }
diff --git a/tests/prs_list.rs b/tests/prs_list.rs
index 7f753c0..75704f6 100644
--- a/tests/prs_list.rs
+++ b/tests/prs_list.rs
@@ -226,17 +226,18 @@ mod when_main_branch_is_uptodate {
226 Ok(()) 226 Ok(())
227 } 227 }
228 228
229 #[test] 229 #[tokio::test]
230 #[serial] 230 #[serial]
231 fn prompts_to_choose_from_pr_titles() -> Result<()> { 231 async fn prompts_to_choose_from_pr_titles() -> Result<()> {
232 futures::executor::block_on(run_async_prompts_to_choose_from_pr_titles()) 232 let _ = run_async_prompts_to_choose_from_pr_titles().await;
233 Ok(())
233 } 234 }
234 } 235 }
235 236
236 #[test] 237 #[tokio::test]
237 #[serial] 238 #[serial]
238 fn pr_branch_created_with_correct_name() -> Result<()> { 239 async fn pr_branch_created_with_correct_name() -> Result<()> {
239 let (_, test_repo) = futures::executor::block_on(prep_and_run())?; 240 let (_, test_repo) = prep_and_run().await?;
240 assert_eq!( 241 assert_eq!(
241 vec![FEATURE_BRANCH_NAME_1, "main"], 242 vec![FEATURE_BRANCH_NAME_1, "main"],
242 test_repo.get_local_branch_names()? 243 test_repo.get_local_branch_names()?
@@ -244,10 +245,10 @@ mod when_main_branch_is_uptodate {
244 Ok(()) 245 Ok(())
245 } 246 }
246 247
247 #[test] 248 #[tokio::test]
248 #[serial] 249 #[serial]
249 fn pr_branch_checked_out() -> Result<()> { 250 async fn pr_branch_checked_out() -> Result<()> {
250 let (_, test_repo) = futures::executor::block_on(prep_and_run())?; 251 let (_, test_repo) = prep_and_run().await?;
251 assert_eq!( 252 assert_eq!(
252 FEATURE_BRANCH_NAME_1, 253 FEATURE_BRANCH_NAME_1,
253 test_repo.get_checked_out_branch_name()?, 254 test_repo.get_checked_out_branch_name()?,
@@ -255,11 +256,10 @@ mod when_main_branch_is_uptodate {
255 Ok(()) 256 Ok(())
256 } 257 }
257 258
258 #[test] 259 #[tokio::test]
259 #[serial] 260 #[serial]
260 fn pr_branch_tip_is_most_recent_patch() -> Result<()> { 261 async fn pr_branch_tip_is_most_recent_patch() -> Result<()> {
261 let (originating_repo, test_repo) = 262 let (originating_repo, test_repo) = prep_and_run().await?;
262 futures::executor::block_on(prep_and_run())?;
263 assert_eq!( 263 assert_eq!(
264 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, 264 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?,
265 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, 265 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?,
@@ -391,17 +391,18 @@ mod when_main_branch_is_uptodate {
391 Ok(()) 391 Ok(())
392 } 392 }
393 393
394 #[test] 394 #[tokio::test]
395 #[serial] 395 #[serial]
396 fn prompts_to_choose_from_pr_titles() -> Result<()> { 396 async fn prompts_to_choose_from_pr_titles() -> Result<()> {
397 futures::executor::block_on(run_async_prompts_to_choose_from_pr_titles()) 397 let _ = run_async_prompts_to_choose_from_pr_titles().await;
398 Ok(())
398 } 399 }
399 } 400 }
400 401
401 #[test] 402 #[tokio::test]
402 #[serial] 403 #[serial]
403 fn pr_branch_created_with_correct_name() -> Result<()> { 404 async fn pr_branch_created_with_correct_name() -> Result<()> {
404 let (_, test_repo) = futures::executor::block_on(prep_and_run())?; 405 let (_, test_repo) = prep_and_run().await?;
405 assert_eq!( 406 assert_eq!(
406 vec![FEATURE_BRANCH_NAME_3, "main"], 407 vec![FEATURE_BRANCH_NAME_3, "main"],
407 test_repo.get_local_branch_names()? 408 test_repo.get_local_branch_names()?
@@ -409,10 +410,10 @@ mod when_main_branch_is_uptodate {
409 Ok(()) 410 Ok(())
410 } 411 }
411 412
412 #[test] 413 #[tokio::test]
413 #[serial] 414 #[serial]
414 fn pr_branch_checked_out() -> Result<()> { 415 async fn pr_branch_checked_out() -> Result<()> {
415 let (_, test_repo) = futures::executor::block_on(prep_and_run())?; 416 let (_, test_repo) = prep_and_run().await?;
416 assert_eq!( 417 assert_eq!(
417 FEATURE_BRANCH_NAME_3, 418 FEATURE_BRANCH_NAME_3,
418 test_repo.get_checked_out_branch_name()?, 419 test_repo.get_checked_out_branch_name()?,
@@ -420,11 +421,10 @@ mod when_main_branch_is_uptodate {
420 Ok(()) 421 Ok(())
421 } 422 }
422 423
423 #[test] 424 #[tokio::test]
424 #[serial] 425 #[serial]
425 fn pr_branch_tip_is_most_recent_patch() -> Result<()> { 426 async fn pr_branch_tip_is_most_recent_patch() -> Result<()> {
426 let (originating_repo, test_repo) = 427 let (originating_repo, test_repo) = prep_and_run().await?;
427 futures::executor::block_on(prep_and_run())?;
428 assert_eq!( 428 assert_eq!(
429 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_3)?, 429 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_3)?,
430 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_3)?, 430 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_3)?,
@@ -579,17 +579,18 @@ mod when_main_branch_is_uptodate {
579 Ok(()) 579 Ok(())
580 } 580 }
581 581
582 #[test] 582 #[tokio::test]
583 #[serial] 583 #[serial]
584 fn prompts_to_choose_from_pr_titles() -> Result<()> { 584 async fn prompts_to_choose_from_pr_titles() -> Result<()> {
585 futures::executor::block_on(run_async_prompts_to_choose_from_pr_titles()) 585 let _ = run_async_prompts_to_choose_from_pr_titles().await;
586 Ok(())
586 } 587 }
587 } 588 }
588 589
589 #[test] 590 #[tokio::test]
590 #[serial] 591 #[serial]
591 fn pr_branch_checked_out() -> Result<()> { 592 async fn pr_branch_checked_out() -> Result<()> {
592 let (_, test_repo) = futures::executor::block_on(prep_and_run())?; 593 let (_, test_repo) = prep_and_run().await?;
593 assert_eq!( 594 assert_eq!(
594 FEATURE_BRANCH_NAME_1, 595 FEATURE_BRANCH_NAME_1,
595 test_repo.get_checked_out_branch_name()?, 596 test_repo.get_checked_out_branch_name()?,
@@ -738,17 +739,18 @@ mod when_main_branch_is_uptodate {
738 Ok(()) 739 Ok(())
739 } 740 }
740 741
741 #[test] 742 #[tokio::test]
742 #[serial] 743 #[serial]
743 fn prompts_to_choose_from_pr_titles() -> Result<()> { 744 async fn prompts_to_choose_from_pr_titles() -> Result<()> {
744 futures::executor::block_on(run_async_prompts_to_choose_from_pr_titles()) 745 let _ = run_async_prompts_to_choose_from_pr_titles().await;
746 Ok(())
745 } 747 }
746 } 748 }
747 749
748 #[test] 750 #[tokio::test]
749 #[serial] 751 #[serial]
750 fn pr_branch_checked_out() -> Result<()> { 752 async fn pr_branch_checked_out() -> Result<()> {
751 let (_, test_repo) = futures::executor::block_on(prep_and_run())?; 753 let (_, test_repo) = prep_and_run().await?;
752 assert_eq!( 754 assert_eq!(
753 FEATURE_BRANCH_NAME_1, 755 FEATURE_BRANCH_NAME_1,
754 test_repo.get_checked_out_branch_name()?, 756 test_repo.get_checked_out_branch_name()?,
@@ -756,11 +758,10 @@ mod when_main_branch_is_uptodate {
756 Ok(()) 758 Ok(())
757 } 759 }
758 760
759 #[test] 761 #[tokio::test]
760 #[serial] 762 #[serial]
761 fn pr_branch_tip_is_most_recent_patch() -> Result<()> { 763 async fn pr_branch_tip_is_most_recent_patch() -> Result<()> {
762 let (originating_repo, test_repo) = 764 let (originating_repo, test_repo) = prep_and_run().await?;
763 futures::executor::block_on(prep_and_run())?;
764 assert_eq!( 765 assert_eq!(
765 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, 766 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?,
766 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, 767 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?,
diff --git a/tests/pull.rs b/tests/pull.rs
index 9b88cb5..92d0ba9 100644
--- a/tests/pull.rs
+++ b/tests/pull.rs
@@ -144,10 +144,10 @@ mod when_main_is_checked_out {
144 Ok(()) 144 Ok(())
145 } 145 }
146 146
147 #[test] 147 #[tokio::test]
148 #[serial] 148 #[serial]
149 fn cli_show_error() -> Result<()> { 149 async fn cli_show_error() -> Result<()> {
150 futures::executor::block_on(run_async_cli_show_error()) 150 run_async_cli_show_error().await
151 } 151 }
152 } 152 }
153} 153}
@@ -209,10 +209,10 @@ mod when_branch_doesnt_exist {
209 Ok(()) 209 Ok(())
210 } 210 }
211 211
212 #[test] 212 #[tokio::test]
213 #[serial] 213 #[serial]
214 fn cli_show_error() -> Result<()> { 214 async fn cli_show_error() -> Result<()> {
215 futures::executor::block_on(run_async_cli_show_error()) 215 run_async_cli_show_error().await
216 } 216 }
217 } 217 }
218} 218}
@@ -274,10 +274,10 @@ mod when_branch_is_checked_out {
274 Ok(()) 274 Ok(())
275 } 275 }
276 276
277 #[test] 277 #[tokio::test]
278 #[serial] 278 #[serial]
279 fn cli_show_up_to_date() -> Result<()> { 279 async fn cli_show_up_to_date() -> Result<()> {
280 futures::executor::block_on(run_async_cli_show_up_to_date()) 280 run_async_cli_show_up_to_date().await
281 } 281 }
282 } 282 }
283 } 283 }
@@ -389,17 +389,17 @@ mod when_branch_is_checked_out {
389 Ok(()) 389 Ok(())
390 } 390 }
391 391
392 #[test] 392 #[tokio::test]
393 #[serial] 393 #[serial]
394 fn cli_applied_1_commit() -> Result<()> { 394 async fn cli_applied_1_commit() -> Result<()> {
395 futures::executor::block_on(run_async_cli_applied_1_commit()) 395 run_async_cli_applied_1_commit().await
396 } 396 }
397 } 397 }
398 398
399 #[test] 399 #[tokio::test]
400 #[serial] 400 #[serial]
401 fn pr_branch_tip_is_most_recent_patch() -> Result<()> { 401 async fn pr_branch_tip_is_most_recent_patch() -> Result<()> {
402 let (originating_repo, test_repo) = futures::executor::block_on(prep_and_run())?; 402 let (originating_repo, test_repo) = prep_and_run().await?;
403 assert_eq!( 403 assert_eq!(
404 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, 404 originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?,
405 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, 405 test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?,
diff --git a/tests/push.rs b/tests/push.rs
index 4fdb6eb..4af5bd4 100644
--- a/tests/push.rs
+++ b/tests/push.rs
@@ -111,6 +111,7 @@ mod when_pr_isnt_associated_with_branch_name {
111 use super::*; 111 use super::*;
112 112
113 mod cli_prompts { 113 mod cli_prompts {
114
114 use super::*; 115 use super::*;
115 async fn run_async_cli_show_error() -> Result<()> { 116 async fn run_async_cli_show_error() -> Result<()> {
116 let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( 117 let (mut r51, mut r52, mut r53, mut r55, mut r56) = (
@@ -164,10 +165,10 @@ mod when_pr_isnt_associated_with_branch_name {
164 Ok(()) 165 Ok(())
165 } 166 }
166 167
167 #[test] 168 #[tokio::test]
168 #[serial] 169 #[serial]
169 fn cli_show_error() -> Result<()> { 170 async fn cli_show_error() -> Result<()> {
170 futures::executor::block_on(run_async_cli_show_error()) 171 run_async_cli_show_error().await
171 } 172 }
172 } 173 }
173} 174}
@@ -229,10 +230,11 @@ mod when_branch_is_checked_out {
229 Ok(()) 230 Ok(())
230 } 231 }
231 232
232 #[test] 233 #[tokio::test]
233 #[serial] 234 #[serial]
234 fn cli_show_up_to_date() -> Result<()> { 235 async fn cli_show_up_to_date() -> Result<()> {
235 futures::executor::block_on(run_async_cli_show_up_to_date()) 236 let _ = run_async_cli_show_up_to_date().await;
237 Ok(())
236 } 238 }
237 } 239 }
238 } 240 }
@@ -291,10 +293,11 @@ mod when_branch_is_checked_out {
291 Ok(()) 293 Ok(())
292 } 294 }
293 295
294 #[test] 296 #[tokio::test]
295 #[serial] 297 #[serial]
296 fn cli_show_up_to_date() -> Result<()> { 298 async fn cli_show_up_to_date() -> Result<()> {
297 futures::executor::block_on(run_async_cli_show_up_to_date()) 299 let _ = run_async_cli_show_up_to_date().await;
300 Ok(())
298 } 301 }
299 } 302 }
300 } 303 }
@@ -389,10 +392,11 @@ mod when_branch_is_checked_out {
389 Ok(()) 392 Ok(())
390 } 393 }
391 394
392 #[test] 395 #[tokio::test]
393 #[serial] 396 #[serial]
394 fn cli_applied_1_commit() -> Result<()> { 397 async fn cli_applied_1_commit() -> Result<()> {
395 futures::executor::block_on(run_async_cli_applied_1_commit()) 398 let _ = run_async_cli_applied_1_commit().await;
399 Ok(())
396 } 400 }
397 } 401 }
398 402
@@ -453,10 +457,10 @@ mod when_branch_is_checked_out {
453 457
454 Ok((res, r55.events.clone())) 458 Ok((res, r55.events.clone()))
455 } 459 }
456 #[test] 460 #[tokio::test]
457 #[serial] 461 #[serial]
458 fn commits_issued_as_patch_event() -> Result<()> { 462 async fn commits_issued_as_patch_event() -> Result<()> {
459 let (test_repo, r55_events) = futures::executor::block_on(prep_and_run())?; 463 let (test_repo, r55_events) = prep_and_run().await?;
460 464
461 let commit_id = test_repo 465 let commit_id = test_repo
462 .get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)? 466 .get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?