diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/git_remote_nostr/main.rs | 2 | ||||
| -rw-r--r-- | tests/git_remote_nostr/push.rs | 30 | ||||
| -rw-r--r-- | tests/ngit_init.rs | 36 | ||||
| -rw-r--r-- | tests/ngit_list.rs | 488 | ||||
| -rw-r--r-- | tests/ngit_login.rs | 352 | ||||
| -rw-r--r-- | tests/ngit_send.rs | 246 |
6 files changed, 460 insertions, 694 deletions
diff --git a/tests/git_remote_nostr/main.rs b/tests/git_remote_nostr/main.rs index 5a1d416..686a5df 100644 --- a/tests/git_remote_nostr/main.rs +++ b/tests/git_remote_nostr/main.rs | |||
| @@ -4,7 +4,7 @@ use anyhow::{Context, Result}; | |||
| 4 | use futures::join; | 4 | use futures::join; |
| 5 | use git2::Oid; | 5 | use git2::Oid; |
| 6 | use nostr::nips::nip01::Coordinate; | 6 | use nostr::nips::nip01::Coordinate; |
| 7 | use nostr_sdk::{secp256k1::rand, Event, JsonUtil, Kind, RelayUrl, ToBech32}; | 7 | use nostr_sdk::{Event, JsonUtil, Kind, RelayUrl, ToBech32, secp256k1::rand}; |
| 8 | use relay::Relay; | 8 | use relay::Relay; |
| 9 | use serial_test::serial; | 9 | use serial_test::serial; |
| 10 | use test_utils::{git::GitTestRepo, *}; | 10 | use test_utils::{git::GitTestRepo, *}; |
diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs index 30602c9..4e44642 100644 --- a/tests/git_remote_nostr/push.rs +++ b/tests/git_remote_nostr/push.rs | |||
| @@ -925,10 +925,12 @@ async fn proposal_three_way_merge_commit_pushed_to_main_leads_to_status_event_is | |||
| 925 | std::fs::write(git_repo.dir.join("new.md"), "some content")?; | 925 | std::fs::write(git_repo.dir.join("new.md"), "some content")?; |
| 926 | git_repo.stage_and_commit("new.md")?; | 926 | git_repo.stage_and_commit("new.md")?; |
| 927 | 927 | ||
| 928 | CliTester::new_git_with_remote_helper_from_dir( | 928 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, [ |
| 929 | &git_repo.dir, | 929 | "merge", |
| 930 | ["merge", &branch_name, "-m", "proposal merge commit message"], | 930 | &branch_name, |
| 931 | ) | 931 | "-m", |
| 932 | "proposal merge commit message", | ||
| 933 | ]) | ||
| 932 | .expect_end_eventually_and_print()?; | 934 | .expect_end_eventually_and_print()?; |
| 933 | 935 | ||
| 934 | let oid = git_repo.get_tip_of_local_branch("main")?; | 936 | let oid = git_repo.get_tip_of_local_branch("main")?; |
| @@ -1079,10 +1081,12 @@ async fn proposal_fast_forward_merge_commits_pushed_to_main_leads_to_status_even | |||
| 1079 | git_repo.checkout_remote_branch(&branch_name)?; | 1081 | git_repo.checkout_remote_branch(&branch_name)?; |
| 1080 | git_repo.checkout("refs/heads/main")?; | 1082 | git_repo.checkout("refs/heads/main")?; |
| 1081 | 1083 | ||
| 1082 | CliTester::new_git_with_remote_helper_from_dir( | 1084 | CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, [ |
| 1083 | &git_repo.dir, | 1085 | "merge", |
| 1084 | ["merge", &branch_name, "-m", "proposal merge commit message"], | 1086 | &branch_name, |
| 1085 | ) | 1087 | "-m", |
| 1088 | "proposal merge commit message", | ||
| 1089 | ]) | ||
| 1086 | .expect_end_eventually_and_print()?; | 1090 | .expect_end_eventually_and_print()?; |
| 1087 | 1091 | ||
| 1088 | let oid = git_repo.get_tip_of_local_branch("main")?; | 1092 | let oid = git_repo.get_tip_of_local_branch("main")?; |
| @@ -1736,10 +1740,12 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> { | |||
| 1736 | std::fs::write(git_repo.dir.join("new2.md"), "some content")?; | 1740 | std::fs::write(git_repo.dir.join("new2.md"), "some content")?; |
| 1737 | git_repo.stage_and_commit("new2.md")?; | 1741 | git_repo.stage_and_commit("new2.md")?; |
| 1738 | 1742 | ||
| 1739 | let mut p = CliTester::new_git_with_remote_helper_from_dir( | 1743 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, [ |
| 1740 | &git_repo.dir, | 1744 | "push", |
| 1741 | ["push", "-u", "origin", branch_name], | 1745 | "-u", |
| 1742 | ); | 1746 | "origin", |
| 1747 | branch_name, | ||
| 1748 | ]); | ||
| 1743 | cli_expect_nostr_fetch(&mut p)?; | 1749 | cli_expect_nostr_fetch(&mut p)?; |
| 1744 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1750 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; |
| 1745 | p.expect("list: connecting...\r\n\r\r\r")?; | 1751 | p.expect("list: connecting...\r\n\r\r\r")?; |
diff --git a/tests/ngit_init.rs b/tests/ngit_init.rs index da4091f..4b61559 100644 --- a/tests/ngit_init.rs +++ b/tests/ngit_init.rs | |||
| @@ -84,14 +84,10 @@ mod when_repo_not_previously_claimed { | |||
| 84 | 8051, | 84 | 8051, |
| 85 | None, | 85 | None, |
| 86 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 86 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 87 | relay.respond_events( | 87 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 88 | client_id, | 88 | generate_test_key_1_metadata_event("fred"), |
| 89 | &subscription_id, | 89 | generate_test_key_1_relay_list_event(), |
| 90 | &vec![ | 90 | ])?; |
| 91 | generate_test_key_1_metadata_event("fred"), | ||
| 92 | generate_test_key_1_relay_list_event(), | ||
| 93 | ], | ||
| 94 | )?; | ||
| 95 | Ok(()) | 91 | Ok(()) |
| 96 | }), | 92 | }), |
| 97 | ), | 93 | ), |
| @@ -211,14 +207,10 @@ mod when_repo_not_previously_claimed { | |||
| 211 | 8051, | 207 | 8051, |
| 212 | None, | 208 | None, |
| 213 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 209 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 214 | relay.respond_events( | 210 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 215 | client_id, | 211 | generate_test_key_1_metadata_event("fred"), |
| 216 | &subscription_id, | 212 | generate_test_key_1_relay_list_event(), |
| 217 | &vec![ | 213 | ])?; |
| 218 | generate_test_key_1_metadata_event("fred"), | ||
| 219 | generate_test_key_1_relay_list_event(), | ||
| 220 | ], | ||
| 221 | )?; | ||
| 222 | Ok(()) | 214 | Ok(()) |
| 223 | }), | 215 | }), |
| 224 | ), | 216 | ), |
| @@ -471,14 +463,10 @@ mod when_repo_not_previously_claimed { | |||
| 471 | 8051, | 463 | 8051, |
| 472 | None, | 464 | None, |
| 473 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 465 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 474 | relay.respond_events( | 466 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 475 | client_id, | 467 | generate_test_key_1_metadata_event("fred"), |
| 476 | &subscription_id, | 468 | generate_test_key_1_relay_list_event(), |
| 477 | &vec![ | 469 | ])?; |
| 478 | generate_test_key_1_metadata_event("fred"), | ||
| 479 | generate_test_key_1_relay_list_event(), | ||
| 480 | ], | ||
| 481 | )?; | ||
| 482 | Ok(()) | 470 | Ok(()) |
| 483 | }), | 471 | }), |
| 484 | ), | 472 | ), |
diff --git a/tests/ngit_list.rs b/tests/ngit_list.rs index 1d297b6..4a3aad5 100644 --- a/tests/ngit_list.rs +++ b/tests/ngit_list.rs | |||
| @@ -49,7 +49,7 @@ async fn prep_proposals_repo_and_repo_with_proposal_pulled_and_checkedout( | |||
| 49 | mod cannot_find_repo_event { | 49 | mod cannot_find_repo_event { |
| 50 | use super::*; | 50 | use super::*; |
| 51 | mod cli_prompts { | 51 | mod cli_prompts { |
| 52 | use nostr::{nips::nip01::Coordinate, ToBech32}; | 52 | use nostr::{ToBech32, nips::nip01::Coordinate}; |
| 53 | use nostr_sdk::RelayUrl; | 53 | use nostr_sdk::RelayUrl; |
| 54 | 54 | ||
| 55 | use super::*; | 55 | use super::*; |
| @@ -196,25 +196,20 @@ mod when_main_branch_is_uptodate { | |||
| 196 | 196 | ||
| 197 | p.expect("fetching updates...\r\n")?; | 197 | p.expect("fetching updates...\r\n")?; |
| 198 | p.expect_eventually("\r\n")?; // some updates listed here | 198 | p.expect_eventually("\r\n")?; // some updates listed here |
| 199 | let mut c = p.expect_choice( | 199 | let mut c = p.expect_choice("all proposals", vec![ |
| 200 | "all proposals", | 200 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 201 | vec![ | 201 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 202 | format!("\"{PROPOSAL_TITLE_3}\""), | 202 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 203 | format!("\"{PROPOSAL_TITLE_2}\""), | 203 | ])?; |
| 204 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 205 | ], | ||
| 206 | )?; | ||
| 207 | c.succeeds_with(2, true, None)?; | 204 | c.succeeds_with(2, true, None)?; |
| 208 | let mut c = p.expect_choice( | 205 | let mut c = p.expect_choice("", vec![ |
| 209 | "", | 206 | format!( |
| 210 | vec![ | 207 | "create and checkout proposal branch (2 ahead 0 behind 'main')" |
| 211 | format!( | 208 | ), |
| 212 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | 209 | format!("apply to current branch with `git am`"), |
| 213 | format!("apply to current branch with `git am`"), | 210 | format!("download to ./patches"), |
| 214 | format!("download to ./patches"), | 211 | format!("back"), |
| 215 | format!("back"), | 212 | ])?; |
| 216 | ], | ||
| 217 | )?; | ||
| 218 | c.succeeds_with(0, true, None)?; | 213 | c.succeeds_with(0, true, None)?; |
| 219 | p.expect(format!( | 214 | p.expect(format!( |
| 220 | "checked out proposal as 'pr/{}(", | 215 | "checked out proposal as 'pr/{}(", |
| @@ -318,25 +313,20 @@ mod when_main_branch_is_uptodate { | |||
| 318 | 313 | ||
| 319 | p.expect("fetching updates...\r\n")?; | 314 | p.expect("fetching updates...\r\n")?; |
| 320 | p.expect_eventually("\r\n")?; // some updates listed here | 315 | p.expect_eventually("\r\n")?; // some updates listed here |
| 321 | let mut c = p.expect_choice( | 316 | let mut c = p.expect_choice("all proposals", vec![ |
| 322 | "all proposals", | 317 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 323 | vec![ | 318 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 324 | format!("\"{PROPOSAL_TITLE_3}\""), | 319 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 325 | format!("\"{PROPOSAL_TITLE_2}\""), | 320 | ])?; |
| 326 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 327 | ], | ||
| 328 | )?; | ||
| 329 | c.succeeds_with(0, true, None)?; | 321 | c.succeeds_with(0, true, None)?; |
| 330 | let mut c = p.expect_choice( | 322 | let mut c = p.expect_choice("", vec![ |
| 331 | "", | 323 | format!( |
| 332 | vec![ | 324 | "create and checkout proposal branch (2 ahead 0 behind 'main')" |
| 333 | format!( | 325 | ), |
| 334 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | 326 | format!("apply to current branch with `git am`"), |
| 335 | format!("apply to current branch with `git am`"), | 327 | format!("download to ./patches"), |
| 336 | format!("download to ./patches"), | 328 | format!("back"), |
| 337 | format!("back"), | 329 | ])?; |
| 338 | ], | ||
| 339 | )?; | ||
| 340 | c.succeeds_with(0, true, Some(0))?; | 330 | c.succeeds_with(0, true, Some(0))?; |
| 341 | p.expect(format!( | 331 | p.expect(format!( |
| 342 | "checked out proposal as 'pr/{}(", | 332 | "checked out proposal as 'pr/{}(", |
| @@ -427,8 +417,8 @@ mod when_main_branch_is_uptodate { | |||
| 427 | r55.events.push(generate_test_key_1_metadata_event("fred")); | 417 | r55.events.push(generate_test_key_1_metadata_event("fred")); |
| 428 | r55.events.push(generate_test_key_1_relay_list_event()); | 418 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 429 | 419 | ||
| 430 | let cli_tester_handle = std::thread::spawn( | 420 | let cli_tester_handle = |
| 431 | move || -> Result<(GitTestRepo, GitTestRepo)> { | 421 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 432 | let originating_repo = cli_tester_create_proposals()?; | 422 | let originating_repo = cli_tester_create_proposals()?; |
| 433 | cli_tester_create_proposal( | 423 | cli_tester_create_proposal( |
| 434 | &originating_repo, | 424 | &originating_repo, |
| @@ -443,26 +433,21 @@ mod when_main_branch_is_uptodate { | |||
| 443 | 433 | ||
| 444 | p.expect("fetching updates...\r\n")?; | 434 | p.expect("fetching updates...\r\n")?; |
| 445 | p.expect_eventually("\r\n")?; // some updates listed here | 435 | p.expect_eventually("\r\n")?; // some updates listed here |
| 446 | let mut c = p.expect_choice( | 436 | let mut c = p.expect_choice("all proposals", vec![ |
| 447 | "all proposals", | 437 | format!("add d3.md"), // commit msg title |
| 448 | vec![ | 438 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 449 | format!("add d3.md"), // commit msg title | 439 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 450 | format!("\"{PROPOSAL_TITLE_3}\""), | 440 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 451 | format!("\"{PROPOSAL_TITLE_2}\""), | 441 | ])?; |
| 452 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 453 | ], | ||
| 454 | )?; | ||
| 455 | c.succeeds_with(0, true, None)?; | 442 | c.succeeds_with(0, true, None)?; |
| 456 | let mut c = p.expect_choice( | 443 | let mut c = p.expect_choice("", vec![ |
| 457 | "", | 444 | format!( |
| 458 | vec![ | 445 | "create and checkout proposal branch (2 ahead 0 behind 'main')" |
| 459 | format!( | 446 | ), |
| 460 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | 447 | format!("apply to current branch with `git am`"), |
| 461 | format!("apply to current branch with `git am`"), | 448 | format!("download to ./patches"), |
| 462 | format!("download to ./patches"), | 449 | format!("back"), |
| 463 | format!("back"), | 450 | ])?; |
| 464 | ], | ||
| 465 | )?; | ||
| 466 | c.succeeds_with(0, true, Some(0))?; | 451 | c.succeeds_with(0, true, Some(0))?; |
| 467 | p.expect_end_eventually_and_print()?; | 452 | p.expect_end_eventually_and_print()?; |
| 468 | 453 | ||
| @@ -470,8 +455,7 @@ mod when_main_branch_is_uptodate { | |||
| 470 | relay::shutdown_relay(8000 + p)?; | 455 | relay::shutdown_relay(8000 + p)?; |
| 471 | } | 456 | } |
| 472 | Ok((originating_repo, test_repo)) | 457 | Ok((originating_repo, test_repo)) |
| 473 | }, | 458 | }); |
| 474 | ); | ||
| 475 | 459 | ||
| 476 | // launch relay | 460 | // launch relay |
| 477 | let _ = join!( | 461 | let _ = join!( |
| @@ -524,26 +508,21 @@ mod when_main_branch_is_uptodate { | |||
| 524 | 508 | ||
| 525 | p.expect("fetching updates...\r\n")?; | 509 | p.expect("fetching updates...\r\n")?; |
| 526 | p.expect_eventually("\r\n")?; // some updates listed here | 510 | p.expect_eventually("\r\n")?; // some updates listed here |
| 527 | let mut c = p.expect_choice( | 511 | let mut c = p.expect_choice("all proposals", vec![ |
| 528 | "all proposals", | 512 | format!("add d3.md"), // commit msg title |
| 529 | vec![ | 513 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 530 | format!("add d3.md"), // commit msg title | 514 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 531 | format!("\"{PROPOSAL_TITLE_3}\""), | 515 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 532 | format!("\"{PROPOSAL_TITLE_2}\""), | 516 | ])?; |
| 533 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 534 | ], | ||
| 535 | )?; | ||
| 536 | c.succeeds_with(0, true, None)?; | 517 | c.succeeds_with(0, true, None)?; |
| 537 | let mut c = p.expect_choice( | 518 | let mut c = p.expect_choice("", vec![ |
| 538 | "", | 519 | format!( |
| 539 | vec![ | 520 | "create and checkout proposal branch (2 ahead 0 behind 'main')" |
| 540 | format!( | 521 | ), |
| 541 | "create and checkout proposal branch (2 ahead 0 behind 'main')" ), | 522 | format!("apply to current branch with `git am`"), |
| 542 | format!("apply to current branch with `git am`"), | 523 | format!("download to ./patches"), |
| 543 | format!("download to ./patches"), | 524 | format!("back"), |
| 544 | format!("back"), | 525 | ])?; |
| 545 | ], | ||
| 546 | )?; | ||
| 547 | c.succeeds_with(0, true, Some(0))?; | 526 | c.succeeds_with(0, true, Some(0))?; |
| 548 | p.expect(format!( | 527 | p.expect(format!( |
| 549 | "checked out proposal as 'pr/{}(", | 528 | "checked out proposal as 'pr/{}(", |
| @@ -639,8 +618,8 @@ mod when_main_branch_is_uptodate { | |||
| 639 | r55.events.push(generate_test_key_1_metadata_event("fred")); | 618 | r55.events.push(generate_test_key_1_metadata_event("fred")); |
| 640 | r55.events.push(generate_test_key_1_relay_list_event()); | 619 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 641 | 620 | ||
| 642 | let cli_tester_handle = std::thread::spawn( | 621 | let cli_tester_handle = |
| 643 | move || -> Result<(GitTestRepo, GitTestRepo)> { | 622 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 644 | let originating_repo = cli_tester_create_proposals()?; | 623 | let originating_repo = cli_tester_create_proposals()?; |
| 645 | 624 | ||
| 646 | let test_repo = GitTestRepo::default(); | 625 | let test_repo = GitTestRepo::default(); |
| @@ -649,24 +628,20 @@ mod when_main_branch_is_uptodate { | |||
| 649 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 628 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 650 | p.expect("fetching updates...\r\n")?; | 629 | p.expect("fetching updates...\r\n")?; |
| 651 | p.expect_eventually("\r\n")?; // some updates listed here | 630 | p.expect_eventually("\r\n")?; // some updates listed here |
| 652 | let mut c = p.expect_choice( | 631 | let mut c = p.expect_choice("all proposals", vec![ |
| 653 | "all proposals", | 632 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 654 | vec![ | 633 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 655 | format!("\"{PROPOSAL_TITLE_3}\""), | 634 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 656 | format!("\"{PROPOSAL_TITLE_2}\""), | 635 | ])?; |
| 657 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 658 | ], | ||
| 659 | )?; | ||
| 660 | c.succeeds_with(2, true, None)?; | 636 | c.succeeds_with(2, true, None)?; |
| 661 | let mut c = p.expect_choice( | 637 | let mut c = p.expect_choice("", vec![ |
| 662 | "", | 638 | format!( |
| 663 | vec![ | 639 | "create and checkout proposal branch (2 ahead 0 behind 'main')" |
| 664 | format!("create and checkout proposal branch (2 ahead 0 behind 'main')"), | 640 | ), |
| 665 | format!("apply to current branch with `git am`"), | 641 | format!("apply to current branch with `git am`"), |
| 666 | format!("download to ./patches"), | 642 | format!("download to ./patches"), |
| 667 | format!("back"), | 643 | format!("back"), |
| 668 | ], | 644 | ])?; |
| 669 | )?; | ||
| 670 | c.succeeds_with(0, true, Some(0))?; | 645 | c.succeeds_with(0, true, Some(0))?; |
| 671 | p.expect_end_eventually()?; | 646 | p.expect_end_eventually()?; |
| 672 | 647 | ||
| @@ -675,24 +650,18 @@ mod when_main_branch_is_uptodate { | |||
| 675 | p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 650 | p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 676 | p.expect("fetching updates...\r\n")?; | 651 | p.expect("fetching updates...\r\n")?; |
| 677 | p.expect_eventually("\r\n")?; // some updates listed here | 652 | p.expect_eventually("\r\n")?; // some updates listed here |
| 678 | let mut c = p.expect_choice( | 653 | let mut c = p.expect_choice("all proposals", vec![ |
| 679 | "all proposals", | 654 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 680 | vec![ | 655 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 681 | format!("\"{PROPOSAL_TITLE_3}\""), | 656 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 682 | format!("\"{PROPOSAL_TITLE_2}\""), | 657 | ])?; |
| 683 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 684 | ], | ||
| 685 | )?; | ||
| 686 | c.succeeds_with(2, true, None)?; | 658 | c.succeeds_with(2, true, None)?; |
| 687 | let mut c = p.expect_choice( | 659 | let mut c = p.expect_choice("", vec![ |
| 688 | "", | 660 | format!("checkout proposal branch (2 ahead 0 behind 'main')"), |
| 689 | vec![ | 661 | format!("apply to current branch with `git am`"), |
| 690 | format!("checkout proposal branch (2 ahead 0 behind 'main')"), | 662 | format!("download to ./patches"), |
| 691 | format!("apply to current branch with `git am`"), | 663 | format!("back"), |
| 692 | format!("download to ./patches"), | 664 | ])?; |
| 693 | format!("back"), | ||
| 694 | ], | ||
| 695 | )?; | ||
| 696 | c.succeeds_with(0, true, Some(0))?; | 665 | c.succeeds_with(0, true, Some(0))?; |
| 697 | p.expect_end_eventually_and_print()?; | 666 | p.expect_end_eventually_and_print()?; |
| 698 | 667 | ||
| @@ -700,8 +669,7 @@ mod when_main_branch_is_uptodate { | |||
| 700 | relay::shutdown_relay(8000 + p)?; | 669 | relay::shutdown_relay(8000 + p)?; |
| 701 | } | 670 | } |
| 702 | Ok((originating_repo, test_repo)) | 671 | Ok((originating_repo, test_repo)) |
| 703 | }, | 672 | }); |
| 704 | ); | ||
| 705 | 673 | ||
| 706 | // launch relay | 674 | // launch relay |
| 707 | let _ = join!( | 675 | let _ = join!( |
| @@ -747,24 +715,20 @@ mod when_main_branch_is_uptodate { | |||
| 747 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 715 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 748 | p.expect("fetching updates...\r\n")?; | 716 | p.expect("fetching updates...\r\n")?; |
| 749 | p.expect_eventually("\r\n")?; // some updates listed here | 717 | p.expect_eventually("\r\n")?; // some updates listed here |
| 750 | let mut c = p.expect_choice( | 718 | let mut c = p.expect_choice("all proposals", vec![ |
| 751 | "all proposals", | 719 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 752 | vec![ | 720 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 753 | format!("\"{PROPOSAL_TITLE_3}\""), | 721 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 754 | format!("\"{PROPOSAL_TITLE_2}\""), | 722 | ])?; |
| 755 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 756 | ], | ||
| 757 | )?; | ||
| 758 | c.succeeds_with(2, true, None)?; | 723 | c.succeeds_with(2, true, None)?; |
| 759 | let mut c = p.expect_choice( | 724 | let mut c = p.expect_choice("", vec![ |
| 760 | "", | 725 | format!( |
| 761 | vec![ | 726 | "create and checkout proposal branch (2 ahead 0 behind 'main')" |
| 762 | format!("create and checkout proposal branch (2 ahead 0 behind 'main')"), | 727 | ), |
| 763 | format!("apply to current branch with `git am`"), | 728 | format!("apply to current branch with `git am`"), |
| 764 | format!("download to ./patches"), | 729 | format!("download to ./patches"), |
| 765 | format!("back"), | 730 | format!("back"), |
| 766 | ], | 731 | ])?; |
| 767 | )?; | ||
| 768 | c.succeeds_with(0, true, Some(0))?; | 732 | c.succeeds_with(0, true, Some(0))?; |
| 769 | p.expect_end_eventually()?; | 733 | p.expect_end_eventually()?; |
| 770 | 734 | ||
| @@ -773,24 +737,18 @@ mod when_main_branch_is_uptodate { | |||
| 773 | p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 737 | p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 774 | p.expect("fetching updates...\r\n")?; | 738 | p.expect("fetching updates...\r\n")?; |
| 775 | p.expect_eventually("\r\n")?; // some updates listed here | 739 | p.expect_eventually("\r\n")?; // some updates listed here |
| 776 | let mut c = p.expect_choice( | 740 | let mut c = p.expect_choice("all proposals", vec![ |
| 777 | "all proposals", | 741 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 778 | vec![ | 742 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 779 | format!("\"{PROPOSAL_TITLE_3}\""), | 743 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 780 | format!("\"{PROPOSAL_TITLE_2}\""), | 744 | ])?; |
| 781 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 782 | ], | ||
| 783 | )?; | ||
| 784 | c.succeeds_with(2, true, None)?; | 745 | c.succeeds_with(2, true, None)?; |
| 785 | let mut c = p.expect_choice( | 746 | let mut c = p.expect_choice("", vec![ |
| 786 | "", | 747 | format!("checkout proposal branch (2 ahead 0 behind 'main')"), |
| 787 | vec![ | 748 | format!("apply to current branch with `git am`"), |
| 788 | format!("checkout proposal branch (2 ahead 0 behind 'main')"), | 749 | format!("download to ./patches"), |
| 789 | format!("apply to current branch with `git am`"), | 750 | format!("back"), |
| 790 | format!("download to ./patches"), | 751 | ])?; |
| 791 | format!("back"), | ||
| 792 | ], | ||
| 793 | )?; | ||
| 794 | c.succeeds_with(0, true, Some(0))?; | 752 | c.succeeds_with(0, true, Some(0))?; |
| 795 | p.expect(format!( | 753 | p.expect(format!( |
| 796 | "checked out proposal as 'pr/{}(", | 754 | "checked out proposal as 'pr/{}(", |
| @@ -864,24 +822,18 @@ mod when_main_branch_is_uptodate { | |||
| 864 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 822 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 865 | p.expect("fetching updates...\r\n")?; | 823 | p.expect("fetching updates...\r\n")?; |
| 866 | p.expect_eventually("\r\n")?; // some updates listed here | 824 | p.expect_eventually("\r\n")?; // some updates listed here |
| 867 | let mut c = p.expect_choice( | 825 | let mut c = p.expect_choice("all proposals", vec![ |
| 868 | "all proposals", | 826 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 869 | vec![ | 827 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 870 | format!("\"{PROPOSAL_TITLE_3}\""), | 828 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 871 | format!("\"{PROPOSAL_TITLE_2}\""), | 829 | ])?; |
| 872 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 873 | ], | ||
| 874 | )?; | ||
| 875 | c.succeeds_with(2, true, None)?; | 830 | c.succeeds_with(2, true, None)?; |
| 876 | let mut c = p.expect_choice( | 831 | let mut c = p.expect_choice("", vec![ |
| 877 | "", | 832 | format!("checkout proposal branch and apply 1 appendments"), |
| 878 | vec![ | 833 | format!("apply to current branch with `git am`"), |
| 879 | format!("checkout proposal branch and apply 1 appendments"), | 834 | format!("download to ./patches"), |
| 880 | format!("apply to current branch with `git am`"), | 835 | format!("back"), |
| 881 | format!("download to ./patches"), | 836 | ])?; |
| 882 | format!("back"), | ||
| 883 | ], | ||
| 884 | )?; | ||
| 885 | c.succeeds_with(0, true, Some(0))?; | 837 | c.succeeds_with(0, true, Some(0))?; |
| 886 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; | 838 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; |
| 887 | p.expect_end()?; | 839 | p.expect_end()?; |
| @@ -940,24 +892,18 @@ mod when_main_branch_is_uptodate { | |||
| 940 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 892 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 941 | p.expect("fetching updates...\r\n")?; | 893 | p.expect("fetching updates...\r\n")?; |
| 942 | p.expect_eventually("\r\n")?; // some updates listed here | 894 | p.expect_eventually("\r\n")?; // some updates listed here |
| 943 | let mut c = p.expect_choice( | 895 | let mut c = p.expect_choice("all proposals", vec![ |
| 944 | "all proposals", | 896 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 945 | vec![ | 897 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 946 | format!("\"{PROPOSAL_TITLE_3}\""), | 898 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 947 | format!("\"{PROPOSAL_TITLE_2}\""), | 899 | ])?; |
| 948 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 949 | ], | ||
| 950 | )?; | ||
| 951 | c.succeeds_with(2, true, None)?; | 900 | c.succeeds_with(2, true, None)?; |
| 952 | let mut c = p.expect_choice( | 901 | let mut c = p.expect_choice("", vec![ |
| 953 | "", | 902 | format!("checkout proposal branch and apply 1 appendments"), |
| 954 | vec![ | 903 | format!("apply to current branch with `git am`"), |
| 955 | format!("checkout proposal branch and apply 1 appendments"), | 904 | format!("download to ./patches"), |
| 956 | format!("apply to current branch with `git am`"), | 905 | format!("back"), |
| 957 | format!("download to ./patches"), | 906 | ])?; |
| 958 | format!("back"), | ||
| 959 | ], | ||
| 960 | )?; | ||
| 961 | c.succeeds_with(0, true, Some(0))?; | 907 | c.succeeds_with(0, true, Some(0))?; |
| 962 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; | 908 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; |
| 963 | p.expect_end()?; | 909 | p.expect_end()?; |
| @@ -1053,29 +999,21 @@ mod when_main_branch_is_uptodate { | |||
| 1053 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 999 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 1054 | p.expect("fetching updates...\r\n")?; | 1000 | p.expect("fetching updates...\r\n")?; |
| 1055 | p.expect_eventually("\r\n")?; // some updates listed here | 1001 | p.expect_eventually("\r\n")?; // some updates listed here |
| 1056 | let mut c = p.expect_choice( | 1002 | let mut c = p.expect_choice("all proposals", vec![ |
| 1057 | "all proposals", | 1003 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1058 | vec![ | 1004 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1059 | format!("\"{PROPOSAL_TITLE_3}\""), | 1005 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1060 | format!("\"{PROPOSAL_TITLE_2}\""), | 1006 | ])?; |
| 1061 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 1062 | ], | ||
| 1063 | )?; | ||
| 1064 | c.succeeds_with(2, true, None)?; | 1007 | c.succeeds_with(2, true, None)?; |
| 1065 | p.expect_eventually("--force`\r\n")?; | 1008 | p.expect_eventually("--force`\r\n")?; |
| 1066 | 1009 | ||
| 1067 | let mut c = p.expect_choice( | 1010 | let mut c = p.expect_choice("", vec![ |
| 1068 | "", | 1011 | format!("checkout local branch with unpublished changes"), |
| 1069 | vec![ | 1012 | format!("discard unpublished changes and checkout new revision"), |
| 1070 | format!("checkout local branch with unpublished changes"), | 1013 | format!("apply to current branch with `git am`"), |
| 1071 | format!( | 1014 | format!("download to ./patches"), |
| 1072 | "discard unpublished changes and checkout new revision" | 1015 | "back".to_string(), |
| 1073 | ), | 1016 | ])?; |
| 1074 | format!("apply to current branch with `git am`"), | ||
| 1075 | format!("download to ./patches"), | ||
| 1076 | "back".to_string(), | ||
| 1077 | ], | ||
| 1078 | )?; | ||
| 1079 | c.succeeds_with(1, true, Some(0))?; | 1017 | c.succeeds_with(1, true, Some(0))?; |
| 1080 | 1018 | ||
| 1081 | p.expect_end_eventually_and_print()?; | 1019 | p.expect_end_eventually_and_print()?; |
| @@ -1132,14 +1070,11 @@ mod when_main_branch_is_uptodate { | |||
| 1132 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 1070 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 1133 | p.expect("fetching updates...\r\n")?; | 1071 | p.expect("fetching updates...\r\n")?; |
| 1134 | p.expect_eventually("\r\n")?; // some updates listed here | 1072 | p.expect_eventually("\r\n")?; // some updates listed here |
| 1135 | let mut c = p.expect_choice( | 1073 | let mut c = p.expect_choice("all proposals", vec![ |
| 1136 | "all proposals", | 1074 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1137 | vec![ | 1075 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1138 | format!("\"{PROPOSAL_TITLE_3}\""), | 1076 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1139 | format!("\"{PROPOSAL_TITLE_2}\""), | 1077 | ])?; |
| 1140 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 1141 | ], | ||
| 1142 | )?; | ||
| 1143 | c.succeeds_with(2, true, None)?; | 1078 | c.succeeds_with(2, true, None)?; |
| 1144 | p.expect("you have an amended/rebase version the proposal that is unpublished\r\n")?; | 1079 | p.expect("you have an amended/rebase version the proposal that is unpublished\r\n")?; |
| 1145 | p.expect("you have previously applied the latest version of the proposal (2 ahead 0 behind 'main') but your local proposal branch has amended or rebased it (2 ahead 0 behind 'main')\r\n")?; | 1080 | p.expect("you have previously applied the latest version of the proposal (2 ahead 0 behind 'main') but your local proposal branch has amended or rebased it (2 ahead 0 behind 'main')\r\n")?; |
| @@ -1148,18 +1083,13 @@ mod when_main_branch_is_uptodate { | |||
| 1148 | p.expect(" 2) run `ngit list` and checkout the latest published version of this proposal\r\n")?; | 1083 | p.expect(" 2) run `ngit list` and checkout the latest published version of this proposal\r\n")?; |
| 1149 | p.expect("if you are confident in your changes consider running `ngit push --force`\r\n")?; | 1084 | p.expect("if you are confident in your changes consider running `ngit push --force`\r\n")?; |
| 1150 | 1085 | ||
| 1151 | let mut c = p.expect_choice( | 1086 | let mut c = p.expect_choice("", vec![ |
| 1152 | "", | 1087 | format!("checkout local branch with unpublished changes"), |
| 1153 | vec![ | 1088 | format!("discard unpublished changes and checkout new revision"), |
| 1154 | format!("checkout local branch with unpublished changes"), | 1089 | format!("apply to current branch with `git am`"), |
| 1155 | format!( | 1090 | format!("download to ./patches"), |
| 1156 | "discard unpublished changes and checkout new revision" | 1091 | "back".to_string(), |
| 1157 | ), | 1092 | ])?; |
| 1158 | format!("apply to current branch with `git am`"), | ||
| 1159 | format!("download to ./patches"), | ||
| 1160 | "back".to_string(), | ||
| 1161 | ], | ||
| 1162 | )?; | ||
| 1163 | c.succeeds_with(1, true, Some(1))?; | 1093 | c.succeeds_with(1, true, Some(1))?; |
| 1164 | p.expect_end_with("checked out latest version of proposal (2 ahead 0 behind 'main'), replacing unpublished version (2 ahead 0 behind 'main')\r\n")?; | 1094 | p.expect_end_with("checked out latest version of proposal (2 ahead 0 behind 'main'), replacing unpublished version (2 ahead 0 behind 'main')\r\n")?; |
| 1165 | 1095 | ||
| @@ -1237,26 +1167,20 @@ mod when_main_branch_is_uptodate { | |||
| 1237 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 1167 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 1238 | p.expect("fetching updates...\r\n")?; | 1168 | p.expect("fetching updates...\r\n")?; |
| 1239 | p.expect_eventually("\r\n")?; // some updates listed here | 1169 | p.expect_eventually("\r\n")?; // some updates listed here |
| 1240 | let mut c = p.expect_choice( | 1170 | let mut c = p.expect_choice("all proposals", vec![ |
| 1241 | "all proposals", | 1171 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1242 | vec![ | 1172 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1243 | format!("\"{PROPOSAL_TITLE_3}\""), | 1173 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1244 | format!("\"{PROPOSAL_TITLE_2}\""), | 1174 | ])?; |
| 1245 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 1246 | ], | ||
| 1247 | )?; | ||
| 1248 | c.succeeds_with(2, true, None)?; | 1175 | c.succeeds_with(2, true, None)?; |
| 1249 | p.expect( | 1176 | p.expect( |
| 1250 | "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n", | 1177 | "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n", |
| 1251 | )?; | 1178 | )?; |
| 1252 | 1179 | ||
| 1253 | let mut c = p.expect_choice( | 1180 | let mut c = p.expect_choice("", vec![ |
| 1254 | "", | 1181 | format!("checkout proposal branch with 1 unpublished commits"), |
| 1255 | vec![ | 1182 | format!("back"), |
| 1256 | format!("checkout proposal branch with 1 unpublished commits"), | 1183 | ])?; |
| 1257 | format!("back"), | ||
| 1258 | ], | ||
| 1259 | )?; | ||
| 1260 | c.succeeds_with(0, true, Some(0))?; | 1184 | c.succeeds_with(0, true, Some(0))?; |
| 1261 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; | 1185 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; |
| 1262 | p.expect_end()?; | 1186 | p.expect_end()?; |
| @@ -1319,26 +1243,20 @@ mod when_main_branch_is_uptodate { | |||
| 1319 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 1243 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 1320 | p.expect("fetching updates...\r\n")?; | 1244 | p.expect("fetching updates...\r\n")?; |
| 1321 | p.expect_eventually("\r\n")?; // some updates listed here | 1245 | p.expect_eventually("\r\n")?; // some updates listed here |
| 1322 | let mut c = p.expect_choice( | 1246 | let mut c = p.expect_choice("all proposals", vec![ |
| 1323 | "all proposals", | 1247 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1324 | vec![ | 1248 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1325 | format!("\"{PROPOSAL_TITLE_3}\""), | 1249 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1326 | format!("\"{PROPOSAL_TITLE_2}\""), | 1250 | ])?; |
| 1327 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 1328 | ], | ||
| 1329 | )?; | ||
| 1330 | c.succeeds_with(2, true, None)?; | 1251 | c.succeeds_with(2, true, None)?; |
| 1331 | p.expect( | 1252 | p.expect( |
| 1332 | "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n", | 1253 | "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n", |
| 1333 | )?; | 1254 | )?; |
| 1334 | 1255 | ||
| 1335 | let mut c = p.expect_choice( | 1256 | let mut c = p.expect_choice("", vec![ |
| 1336 | "", | 1257 | format!("checkout proposal branch with 1 unpublished commits"), |
| 1337 | vec![ | 1258 | format!("back"), |
| 1338 | format!("checkout proposal branch with 1 unpublished commits"), | 1259 | ])?; |
| 1339 | format!("back"), | ||
| 1340 | ], | ||
| 1341 | )?; | ||
| 1342 | c.succeeds_with(0, true, Some(0))?; | 1260 | c.succeeds_with(0, true, Some(0))?; |
| 1343 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; | 1261 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; |
| 1344 | p.expect_end()?; | 1262 | p.expect_end()?; |
| @@ -1421,26 +1339,20 @@ mod when_main_branch_is_uptodate { | |||
| 1421 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 1339 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 1422 | p.expect("fetching updates...\r\n")?; | 1340 | p.expect("fetching updates...\r\n")?; |
| 1423 | p.expect_eventually("\r\n")?; // some updates listed here | 1341 | p.expect_eventually("\r\n")?; // some updates listed here |
| 1424 | let mut c = p.expect_choice( | 1342 | let mut c = p.expect_choice("all proposals", vec![ |
| 1425 | "all proposals", | 1343 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1426 | vec![ | 1344 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1427 | format!("\"{PROPOSAL_TITLE_3}\""), | 1345 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1428 | format!("\"{PROPOSAL_TITLE_2}\""), | 1346 | ])?; |
| 1429 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 1430 | ], | ||
| 1431 | )?; | ||
| 1432 | c.succeeds_with(2, true, None)?; | 1347 | c.succeeds_with(2, true, None)?; |
| 1433 | p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; | 1348 | p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; |
| 1434 | let mut c = p.expect_choice( | 1349 | let mut c = p.expect_choice("", vec![ |
| 1435 | "", | 1350 | format!("checkout and overwrite existing proposal branch"), |
| 1436 | vec![ | 1351 | format!("checkout existing outdated proposal branch"), |
| 1437 | format!("checkout and overwrite existing proposal branch"), | 1352 | format!("apply to current branch with `git am`"), |
| 1438 | format!("checkout existing outdated proposal branch"), | 1353 | format!("download to ./patches"), |
| 1439 | format!("apply to current branch with `git am`"), | 1354 | format!("back"), |
| 1440 | format!("download to ./patches"), | 1355 | ])?; |
| 1441 | format!("back"), | ||
| 1442 | ], | ||
| 1443 | )?; | ||
| 1444 | c.succeeds_with(0, true, Some(0))?; | 1356 | c.succeeds_with(0, true, Some(0))?; |
| 1445 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; | 1357 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; |
| 1446 | p.expect_end()?; | 1358 | p.expect_end()?; |
| @@ -1494,26 +1406,20 @@ mod when_main_branch_is_uptodate { | |||
| 1494 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 1406 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 1495 | p.expect("fetching updates...\r\n")?; | 1407 | p.expect("fetching updates...\r\n")?; |
| 1496 | p.expect_eventually("\r\n")?; // some updates listed here | 1408 | p.expect_eventually("\r\n")?; // some updates listed here |
| 1497 | let mut c = p.expect_choice( | 1409 | let mut c = p.expect_choice("all proposals", vec![ |
| 1498 | "all proposals", | 1410 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1499 | vec![ | 1411 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1500 | format!("\"{PROPOSAL_TITLE_3}\""), | 1412 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1501 | format!("\"{PROPOSAL_TITLE_2}\""), | 1413 | ])?; |
| 1502 | format!("\"{PROPOSAL_TITLE_1}\""), | ||
| 1503 | ], | ||
| 1504 | )?; | ||
| 1505 | c.succeeds_with(2, true, None)?; | 1414 | c.succeeds_with(2, true, None)?; |
| 1506 | p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; | 1415 | p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; |
| 1507 | let mut c = p.expect_choice( | 1416 | let mut c = p.expect_choice("", vec![ |
| 1508 | "", | 1417 | format!("checkout and overwrite existing proposal branch"), |
| 1509 | vec![ | 1418 | format!("checkout existing outdated proposal branch"), |
| 1510 | format!("checkout and overwrite existing proposal branch"), | 1419 | format!("apply to current branch with `git am`"), |
| 1511 | format!("checkout existing outdated proposal branch"), | 1420 | format!("download to ./patches"), |
| 1512 | format!("apply to current branch with `git am`"), | 1421 | format!("back"), |
| 1513 | format!("download to ./patches"), | 1422 | ])?; |
| 1514 | format!("back"), | ||
| 1515 | ], | ||
| 1516 | )?; | ||
| 1517 | c.succeeds_with(0, true, Some(0))?; | 1423 | c.succeeds_with(0, true, Some(0))?; |
| 1518 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; | 1424 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; |
| 1519 | p.expect_end()?; | 1425 | p.expect_end()?; |
diff --git a/tests/ngit_login.rs b/tests/ngit_login.rs index 78a160c..b1e2676 100644 --- a/tests/ngit_login.rs +++ b/tests/ngit_login.rs | |||
| @@ -6,27 +6,21 @@ use test_utils::*; | |||
| 6 | static EXPECTED_NSEC_PROMPT: &str = "nsec"; | 6 | static EXPECTED_NSEC_PROMPT: &str = "nsec"; |
| 7 | 7 | ||
| 8 | fn show_first_time_login_choices(p: &mut CliTester) -> Result<CliTesterChoicePrompt> { | 8 | fn show_first_time_login_choices(p: &mut CliTester) -> Result<CliTesterChoicePrompt> { |
| 9 | p.expect_choice( | 9 | p.expect_choice("login to nostr", vec![ |
| 10 | "login to nostr", | 10 | "secret key (nsec / ncryptsec)".to_string(), |
| 11 | vec![ | 11 | "nostr connect (remote signer)".to_string(), |
| 12 | "secret key (nsec / ncryptsec)".to_string(), | 12 | "create account".to_string(), |
| 13 | "nostr connect (remote signer)".to_string(), | 13 | "help".to_string(), |
| 14 | "create account".to_string(), | 14 | ]) |
| 15 | "help".to_string(), | ||
| 16 | ], | ||
| 17 | ) | ||
| 18 | } | 15 | } |
| 19 | 16 | ||
| 20 | fn first_time_login_choices_succeeds_with_nsec(p: &mut CliTester, nsec: &str) -> Result<()> { | 17 | fn first_time_login_choices_succeeds_with_nsec(p: &mut CliTester, nsec: &str) -> Result<()> { |
| 21 | p.expect_choice( | 18 | p.expect_choice("login to nostr", vec![ |
| 22 | "login to nostr", | 19 | "secret key (nsec / ncryptsec)".to_string(), |
| 23 | vec![ | 20 | "nostr connect (remote signer)".to_string(), |
| 24 | "secret key (nsec / ncryptsec)".to_string(), | 21 | "create account".to_string(), |
| 25 | "nostr connect (remote signer)".to_string(), | 22 | "help".to_string(), |
| 26 | "create account".to_string(), | 23 | ])? |
| 27 | "help".to_string(), | ||
| 28 | ], | ||
| 29 | )? | ||
| 30 | .succeeds_with(0, false, Some(0))?; | 24 | .succeeds_with(0, false, Some(0))?; |
| 31 | 25 | ||
| 32 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 26 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| @@ -49,7 +43,7 @@ fn standard_first_time_login_with_nsec() -> Result<CliTester> { | |||
| 49 | mod with_relays { | 43 | mod with_relays { |
| 50 | use anyhow::Ok; | 44 | use anyhow::Ok; |
| 51 | use futures::join; | 45 | use futures::join; |
| 52 | use test_utils::relay::{shutdown_relay, ListenerReqFunc, Relay}; | 46 | use test_utils::relay::{ListenerReqFunc, Relay, shutdown_relay}; |
| 53 | 47 | ||
| 54 | use super::*; | 48 | use super::*; |
| 55 | 49 | ||
| @@ -137,25 +131,17 @@ mod with_relays { | |||
| 137 | async fn when_latest_metadata_and_relay_list_on_all_relays() -> Result<()> { | 131 | async fn when_latest_metadata_and_relay_list_on_all_relays() -> Result<()> { |
| 138 | run_test_displays_correct_name( | 132 | run_test_displays_correct_name( |
| 139 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 133 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 140 | relay.respond_events( | 134 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 141 | client_id, | 135 | generate_test_key_1_metadata_event("fred"), |
| 142 | &subscription_id, | 136 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 143 | &vec![ | 137 | ])?; |
| 144 | generate_test_key_1_metadata_event("fred"), | ||
| 145 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 146 | ], | ||
| 147 | )?; | ||
| 148 | Ok(()) | 138 | Ok(()) |
| 149 | }), | 139 | }), |
| 150 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 140 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 151 | relay.respond_events( | 141 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 152 | client_id, | 142 | generate_test_key_1_metadata_event("fred"), |
| 153 | &subscription_id, | 143 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 154 | &vec![ | 144 | ])?; |
| 155 | generate_test_key_1_metadata_event("fred"), | ||
| 156 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 157 | ], | ||
| 158 | )?; | ||
| 159 | Ok(()) | 145 | Ok(()) |
| 160 | }), | 146 | }), |
| 161 | ) | 147 | ) |
| @@ -170,18 +156,14 @@ mod with_relays { | |||
| 170 | async fn when_metadata_contains_only_display_name() -> Result<()> { | 156 | async fn when_metadata_contains_only_display_name() -> Result<()> { |
| 171 | run_test_displays_correct_name( | 157 | run_test_displays_correct_name( |
| 172 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 158 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 173 | relay.respond_events( | 159 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 174 | client_id, | 160 | nostr::event::EventBuilder::metadata( |
| 175 | &subscription_id, | 161 | &nostr::Metadata::new().display_name("fred"), |
| 176 | &vec![ | 162 | ) |
| 177 | nostr::event::EventBuilder::metadata( | 163 | .sign_with_keys(&TEST_KEY_1_KEYS) |
| 178 | &nostr::Metadata::new().display_name("fred"), | 164 | .unwrap(), |
| 179 | ) | 165 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 180 | .sign_with_keys(&TEST_KEY_1_KEYS) | 166 | ])?; |
| 181 | .unwrap(), | ||
| 182 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 183 | ], | ||
| 184 | )?; | ||
| 185 | Ok(()) | 167 | Ok(()) |
| 186 | }), | 168 | }), |
| 187 | None, | 169 | None, |
| @@ -207,19 +189,14 @@ mod with_relays { | |||
| 207 | 189 | ||
| 208 | run_test_displays_correct_name( | 190 | run_test_displays_correct_name( |
| 209 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 191 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 210 | relay.respond_events( | 192 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 211 | client_id, | 193 | nostr::event::EventBuilder::metadata( |
| 212 | &subscription_id, | 194 | &nostr::Metadata::new().custom_field("displayName", "fred"), |
| 213 | &vec![ | 195 | ) |
| 214 | nostr::event::EventBuilder::metadata( | 196 | .sign_with_keys(&TEST_KEY_1_KEYS) |
| 215 | &nostr::Metadata::new() | 197 | .unwrap(), |
| 216 | .custom_field("displayName", "fred"), | 198 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 217 | ) | 199 | ])?; |
| 218 | .sign_with_keys(&TEST_KEY_1_KEYS) | ||
| 219 | .unwrap(), | ||
| 220 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 221 | ], | ||
| 222 | )?; | ||
| 223 | Ok(()) | 200 | Ok(()) |
| 224 | }), | 201 | }), |
| 225 | None, | 202 | None, |
| @@ -233,18 +210,14 @@ mod with_relays { | |||
| 233 | -> Result<()> { | 210 | -> Result<()> { |
| 234 | run_test_displays_fallback_to_npub( | 211 | run_test_displays_fallback_to_npub( |
| 235 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 212 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 236 | relay.respond_events( | 213 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 237 | client_id, | 214 | nostr::event::EventBuilder::metadata( |
| 238 | &subscription_id, | 215 | &nostr::Metadata::new().about("other info in metadata"), |
| 239 | &vec![ | 216 | ) |
| 240 | nostr::event::EventBuilder::metadata( | 217 | .sign_with_keys(&TEST_KEY_1_KEYS) |
| 241 | &nostr::Metadata::new().about("other info in metadata"), | 218 | .unwrap(), |
| 242 | ) | 219 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 243 | .sign_with_keys(&TEST_KEY_1_KEYS) | 220 | ])?; |
| 244 | .unwrap(), | ||
| 245 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 246 | ], | ||
| 247 | )?; | ||
| 248 | Ok(()) | 221 | Ok(()) |
| 249 | }), | 222 | }), |
| 250 | None, | 223 | None, |
| @@ -259,14 +232,10 @@ mod with_relays { | |||
| 259 | -> Result<()> { | 232 | -> Result<()> { |
| 260 | run_test_displays_correct_name( | 233 | run_test_displays_correct_name( |
| 261 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 234 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 262 | relay.respond_events( | 235 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 263 | client_id, | 236 | generate_test_key_1_metadata_event("fred"), |
| 264 | &subscription_id, | 237 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 265 | &vec![ | 238 | ])?; |
| 266 | generate_test_key_1_metadata_event("fred"), | ||
| 267 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 268 | ], | ||
| 269 | )?; | ||
| 270 | Ok(()) | 239 | Ok(()) |
| 271 | }), | 240 | }), |
| 272 | None, | 241 | None, |
| @@ -280,19 +249,15 @@ mod with_relays { | |||
| 280 | { | 249 | { |
| 281 | run_test_displays_correct_name( | 250 | run_test_displays_correct_name( |
| 282 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 251 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 283 | relay.respond_events( | 252 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 284 | client_id, | 253 | generate_test_key_1_metadata_event("fred"), |
| 285 | &subscription_id, | 254 | ])?; |
| 286 | &vec![generate_test_key_1_metadata_event("fred")], | ||
| 287 | )?; | ||
| 288 | Ok(()) | 255 | Ok(()) |
| 289 | }), | 256 | }), |
| 290 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 257 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 291 | relay.respond_events( | 258 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 292 | client_id, | 259 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 293 | &subscription_id, | 260 | ])?; |
| 294 | &vec![generate_test_key_1_relay_list_event_same_as_fallback()], | ||
| 295 | )?; | ||
| 296 | Ok(()) | 261 | Ok(()) |
| 297 | }), | 262 | }), |
| 298 | ) | 263 | ) |
| @@ -304,22 +269,16 @@ mod with_relays { | |||
| 304 | async fn when_some_relays_return_old_metadata_event() -> Result<()> { | 269 | async fn when_some_relays_return_old_metadata_event() -> Result<()> { |
| 305 | run_test_displays_correct_name( | 270 | run_test_displays_correct_name( |
| 306 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 271 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 307 | relay.respond_events( | 272 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 308 | client_id, | 273 | generate_test_key_1_metadata_event("fred"), |
| 309 | &subscription_id, | 274 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 310 | &vec![ | 275 | ])?; |
| 311 | generate_test_key_1_metadata_event("fred"), | ||
| 312 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 313 | ], | ||
| 314 | )?; | ||
| 315 | Ok(()) | 276 | Ok(()) |
| 316 | }), | 277 | }), |
| 317 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 278 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 318 | relay.respond_events( | 279 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 319 | client_id, | 280 | generate_test_key_1_metadata_event_old("fred old"), |
| 320 | &subscription_id, | 281 | ])?; |
| 321 | &vec![generate_test_key_1_metadata_event_old("fred old")], | ||
| 322 | )?; | ||
| 323 | Ok(()) | 282 | Ok(()) |
| 324 | }), | 283 | }), |
| 325 | ) | 284 | ) |
| @@ -331,22 +290,16 @@ mod with_relays { | |||
| 331 | async fn when_some_relays_return_other_users_metadata() -> Result<()> { | 290 | async fn when_some_relays_return_other_users_metadata() -> Result<()> { |
| 332 | run_test_displays_correct_name( | 291 | run_test_displays_correct_name( |
| 333 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 292 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 334 | relay.respond_events( | 293 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 335 | client_id, | 294 | generate_test_key_2_metadata_event("carole"), |
| 336 | &subscription_id, | 295 | ])?; |
| 337 | &vec![generate_test_key_2_metadata_event("carole")], | ||
| 338 | )?; | ||
| 339 | Ok(()) | 296 | Ok(()) |
| 340 | }), | 297 | }), |
| 341 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 298 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 342 | relay.respond_events( | 299 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 343 | client_id, | 300 | generate_test_key_1_metadata_event_old("fred"), |
| 344 | &subscription_id, | 301 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 345 | &vec![ | 302 | ])?; |
| 346 | generate_test_key_1_metadata_event_old("fred"), | ||
| 347 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 348 | ], | ||
| 349 | )?; | ||
| 350 | Ok(()) | 303 | Ok(()) |
| 351 | }), | 304 | }), |
| 352 | ) | 305 | ) |
| @@ -359,22 +312,16 @@ mod with_relays { | |||
| 359 | run_test_displays_correct_name( | 312 | run_test_displays_correct_name( |
| 360 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 313 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 361 | let event = generate_test_key_1_kind_event(nostr::Kind::TextNote); | 314 | let event = generate_test_key_1_kind_event(nostr::Kind::TextNote); |
| 362 | relay.respond_events( | 315 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 363 | client_id, | 316 | make_event_old_or_change_user(event, &TEST_KEY_1_KEYS, 0), |
| 364 | &subscription_id, | 317 | ])?; |
| 365 | &vec![make_event_old_or_change_user(event, &TEST_KEY_1_KEYS, 0)], | ||
| 366 | )?; | ||
| 367 | Ok(()) | 318 | Ok(()) |
| 368 | }), | 319 | }), |
| 369 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 320 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 370 | relay.respond_events( | 321 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 371 | client_id, | 322 | generate_test_key_1_metadata_event_old("fred"), |
| 372 | &subscription_id, | 323 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 373 | &vec![ | 324 | ])?; |
| 374 | generate_test_key_1_metadata_event_old("fred"), | ||
| 375 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 376 | ], | ||
| 377 | )?; | ||
| 378 | Ok(()) | 325 | Ok(()) |
| 379 | }), | 326 | }), |
| 380 | ) | 327 | ) |
| @@ -389,14 +336,10 @@ mod with_relays { | |||
| 389 | async fn displays_correct_name() -> Result<()> { | 336 | async fn displays_correct_name() -> Result<()> { |
| 390 | run_test_when_specifying_command_line_nsec_only_displays_correct_name( | 337 | run_test_when_specifying_command_line_nsec_only_displays_correct_name( |
| 391 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 338 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 392 | relay.respond_events( | 339 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 393 | client_id, | 340 | generate_test_key_1_metadata_event("fred"), |
| 394 | &subscription_id, | 341 | generate_test_key_1_relay_list_event_same_as_fallback(), |
| 395 | &vec![ | 342 | ])?; |
| 396 | generate_test_key_1_metadata_event("fred"), | ||
| 397 | generate_test_key_1_relay_list_event_same_as_fallback(), | ||
| 398 | ], | ||
| 399 | )?; | ||
| 400 | Ok(()) | 343 | Ok(()) |
| 401 | }), | 344 | }), |
| 402 | None, | 345 | None, |
| @@ -414,10 +357,12 @@ mod with_relays { | |||
| 414 | 357 | ||
| 415 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 358 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 416 | let test_repo = GitTestRepo::default(); | 359 | let test_repo = GitTestRepo::default(); |
| 417 | let mut p = CliTester::new_from_dir( | 360 | let mut p = CliTester::new_from_dir(&test_repo.dir, [ |
| 418 | &test_repo.dir, | 361 | "account", |
| 419 | ["account", "login", "--nsec", TEST_KEY_1_NSEC], | 362 | "login", |
| 420 | ); | 363 | "--nsec", |
| 364 | TEST_KEY_1_NSEC, | ||
| 365 | ]); | ||
| 421 | 366 | ||
| 422 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; | 367 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; |
| 423 | 368 | ||
| @@ -489,11 +434,9 @@ mod with_relays { | |||
| 489 | async fn warm_user_and_displays_name() -> Result<()> { | 434 | async fn warm_user_and_displays_name() -> Result<()> { |
| 490 | run_test_when_no_relay_list_found_warns_user_and_uses_npub( | 435 | run_test_when_no_relay_list_found_warns_user_and_uses_npub( |
| 491 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 436 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 492 | relay.respond_events( | 437 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 493 | client_id, | 438 | generate_test_key_1_metadata_event("fred"), |
| 494 | &subscription_id, | 439 | ])?; |
| 495 | &vec![generate_test_key_1_metadata_event("fred")], | ||
| 496 | )?; | ||
| 497 | Ok(()) | 440 | Ok(()) |
| 498 | }), | 441 | }), |
| 499 | None, | 442 | None, |
| @@ -584,25 +527,17 @@ mod with_relays { | |||
| 584 | async fn displays_correct_name() -> Result<()> { | 527 | async fn displays_correct_name() -> Result<()> { |
| 585 | run_test_displays_correct_name( | 528 | run_test_displays_correct_name( |
| 586 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 529 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 587 | relay.respond_events( | 530 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 588 | client_id, | 531 | generate_test_key_1_metadata_event_old("Fred"), |
| 589 | &subscription_id, | 532 | generate_test_key_1_relay_list_event(), |
| 590 | &vec![ | 533 | ])?; |
| 591 | generate_test_key_1_metadata_event_old("Fred"), | ||
| 592 | generate_test_key_1_relay_list_event(), | ||
| 593 | ], | ||
| 594 | )?; | ||
| 595 | Ok(()) | 534 | Ok(()) |
| 596 | }), | 535 | }), |
| 597 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 536 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 598 | relay.respond_events( | 537 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 599 | client_id, | 538 | generate_test_key_1_metadata_event("fred"), |
| 600 | &subscription_id, | 539 | generate_test_key_1_relay_list_event(), |
| 601 | &vec![ | 540 | ])?; |
| 602 | generate_test_key_1_metadata_event("fred"), | ||
| 603 | generate_test_key_1_relay_list_event(), | ||
| 604 | ], | ||
| 605 | )?; | ||
| 606 | Ok(()) | 541 | Ok(()) |
| 607 | }), | 542 | }), |
| 608 | ) | 543 | ) |
| @@ -674,10 +609,10 @@ mod with_offline_flag { | |||
| 674 | true, | 609 | true, |
| 675 | )?; | 610 | )?; |
| 676 | 611 | ||
| 677 | p.expect_choice( | 612 | p.expect_choice("login to nostr", vec![ |
| 678 | "login to nostr", | 613 | "try again with nsec".to_string(), |
| 679 | vec!["try again with nsec".to_string(), "back".to_string()], | 614 | "back".to_string(), |
| 680 | )? | 615 | ])? |
| 681 | .succeeds_with(0, false, Some(0))?; | 616 | .succeeds_with(0, false, Some(0))?; |
| 682 | } | 617 | } |
| 683 | 618 | ||
| @@ -697,10 +632,13 @@ mod with_offline_flag { | |||
| 697 | #[test] | 632 | #[test] |
| 698 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { | 633 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { |
| 699 | let test_repo = GitTestRepo::default(); | 634 | let test_repo = GitTestRepo::default(); |
| 700 | let mut p = CliTester::new_from_dir( | 635 | let mut p = CliTester::new_from_dir(&test_repo.dir, [ |
| 701 | &test_repo.dir, | 636 | "account", |
| 702 | ["account", "login", "--offline", "--nsec", TEST_KEY_1_NSEC], | 637 | "login", |
| 703 | ); | 638 | "--offline", |
| 639 | "--nsec", | ||
| 640 | TEST_KEY_1_NSEC, | ||
| 641 | ]); | ||
| 704 | 642 | ||
| 705 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; | 643 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; |
| 706 | 644 | ||
| @@ -712,10 +650,13 @@ mod with_offline_flag { | |||
| 712 | #[test] | 650 | #[test] |
| 713 | fn invalid_nsec_param_fails_without_prompts() -> Result<()> { | 651 | fn invalid_nsec_param_fails_without_prompts() -> Result<()> { |
| 714 | let test_repo = GitTestRepo::default(); | 652 | let test_repo = GitTestRepo::default(); |
| 715 | let mut p = CliTester::new_from_dir( | 653 | let mut p = CliTester::new_from_dir(&test_repo.dir, [ |
| 716 | &test_repo.dir, | 654 | "account", |
| 717 | ["account", "login", "--offline", "--nsec", TEST_INVALID_NSEC], | 655 | "login", |
| 718 | ); | 656 | "--offline", |
| 657 | "--nsec", | ||
| 658 | TEST_INVALID_NSEC, | ||
| 659 | ]); | ||
| 719 | 660 | ||
| 720 | p.expect_end_with( | 661 | p.expect_end_with( |
| 721 | "Error: invalid nsec parameter\r\n\r\nCaused by:\r\n Invalid secret key\r\n", | 662 | "Error: invalid nsec parameter\r\n\r\nCaused by:\r\n Invalid secret key\r\n", |
| @@ -729,18 +670,15 @@ mod with_offline_flag { | |||
| 729 | #[test] | 670 | #[test] |
| 730 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { | 671 | fn valid_nsec_param_succeeds_without_prompts() -> Result<()> { |
| 731 | let test_repo = GitTestRepo::default(); | 672 | let test_repo = GitTestRepo::default(); |
| 732 | let mut p = CliTester::new_from_dir( | 673 | let mut p = CliTester::new_from_dir(&test_repo.dir, [ |
| 733 | &test_repo.dir, | 674 | "account", |
| 734 | [ | 675 | "login", |
| 735 | "account", | 676 | "--offline", |
| 736 | "login", | 677 | "--nsec", |
| 737 | "--offline", | 678 | TEST_KEY_1_NSEC, |
| 738 | "--nsec", | 679 | "--password", |
| 739 | TEST_KEY_1_NSEC, | 680 | TEST_PASSWORD, |
| 740 | "--password", | 681 | ]); |
| 741 | TEST_PASSWORD, | ||
| 742 | ], | ||
| 743 | ); | ||
| 744 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; | 682 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; |
| 745 | 683 | ||
| 746 | p.expect_end_with( | 684 | p.expect_end_with( |
| @@ -751,18 +689,15 @@ mod with_offline_flag { | |||
| 751 | #[test] | 689 | #[test] |
| 752 | fn parameters_can_be_called_globally() -> Result<()> { | 690 | fn parameters_can_be_called_globally() -> Result<()> { |
| 753 | let test_repo = GitTestRepo::default(); | 691 | let test_repo = GitTestRepo::default(); |
| 754 | let mut p = CliTester::new_from_dir( | 692 | let mut p = CliTester::new_from_dir(&test_repo.dir, [ |
| 755 | &test_repo.dir, | 693 | "--nsec", |
| 756 | [ | 694 | TEST_KEY_1_NSEC, |
| 757 | "--nsec", | 695 | "--password", |
| 758 | TEST_KEY_1_NSEC, | 696 | TEST_PASSWORD, |
| 759 | "--password", | 697 | "account", |
| 760 | TEST_PASSWORD, | 698 | "login", |
| 761 | "account", | 699 | "--offline", |
| 762 | "login", | 700 | ]); |
| 763 | "--offline", | ||
| 764 | ], | ||
| 765 | ); | ||
| 766 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; | 701 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; |
| 767 | 702 | ||
| 768 | p.expect_end_with( | 703 | p.expect_end_with( |
| @@ -777,18 +712,15 @@ mod with_offline_flag { | |||
| 777 | fn valid_nsec_param_succeeds_without_prompts_and_logs_in() -> Result<()> { | 712 | fn valid_nsec_param_succeeds_without_prompts_and_logs_in() -> Result<()> { |
| 778 | standard_first_time_login_with_nsec()?.exit()?; | 713 | standard_first_time_login_with_nsec()?.exit()?; |
| 779 | let test_repo = GitTestRepo::default(); | 714 | let test_repo = GitTestRepo::default(); |
| 780 | let mut p = CliTester::new_from_dir( | 715 | let mut p = CliTester::new_from_dir(&test_repo.dir, [ |
| 781 | &test_repo.dir, | 716 | "account", |
| 782 | [ | 717 | "login", |
| 783 | "account", | 718 | "--offline", |
| 784 | "login", | 719 | "--nsec", |
| 785 | "--offline", | 720 | TEST_KEY_2_NSEC, |
| 786 | "--nsec", | 721 | "--password", |
| 787 | TEST_KEY_2_NSEC, | 722 | TEST_PASSWORD, |
| 788 | "--password", | 723 | ]); |
| 789 | TEST_PASSWORD, | ||
| 790 | ], | ||
| 791 | ); | ||
| 792 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; | 724 | p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; |
| 793 | 725 | ||
| 794 | p.expect_end_with( | 726 | p.expect_end_with( |
diff --git a/tests/ngit_send.rs b/tests/ngit_send.rs index 1ffb515..d728d9c 100644 --- a/tests/ngit_send.rs +++ b/tests/ngit_send.rs | |||
| @@ -181,14 +181,10 @@ async fn prep_run_create_proposal( | |||
| 181 | 8051, | 181 | 8051, |
| 182 | None, | 182 | None, |
| 183 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 183 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 184 | relay.respond_events( | 184 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 185 | client_id, | 185 | generate_test_key_1_metadata_event("fred"), |
| 186 | &subscription_id, | 186 | generate_test_key_1_relay_list_event(), |
| 187 | &vec![ | 187 | ])?; |
| 188 | generate_test_key_1_metadata_event("fred"), | ||
| 189 | generate_test_key_1_relay_list_event(), | ||
| 190 | ], | ||
| 191 | )?; | ||
| 192 | Ok(()) | 188 | Ok(()) |
| 193 | }), | 189 | }), |
| 194 | ), | 190 | ), |
| @@ -198,11 +194,9 @@ async fn prep_run_create_proposal( | |||
| 198 | 8055, | 194 | 8055, |
| 199 | None, | 195 | None, |
| 200 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 196 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 201 | relay.respond_events( | 197 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 202 | client_id, | 198 | generate_repo_ref_event(), |
| 203 | &subscription_id, | 199 | ])?; |
| 204 | &vec![generate_repo_ref_event()], | ||
| 205 | )?; | ||
| 206 | Ok(()) | 200 | Ok(()) |
| 207 | }), | 201 | }), |
| 208 | ), | 202 | ), |
| @@ -764,14 +758,10 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 764 | 8051, | 758 | 8051, |
| 765 | None, | 759 | None, |
| 766 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 760 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 767 | relay.respond_events( | 761 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 768 | client_id, | 762 | generate_test_key_1_metadata_event("fred"), |
| 769 | &subscription_id, | 763 | generate_test_key_1_relay_list_event(), |
| 770 | &vec![ | 764 | ])?; |
| 771 | generate_test_key_1_metadata_event("fred"), | ||
| 772 | generate_test_key_1_relay_list_event(), | ||
| 773 | ], | ||
| 774 | )?; | ||
| 775 | Ok(()) | 765 | Ok(()) |
| 776 | }), | 766 | }), |
| 777 | ), | 767 | ), |
| @@ -781,11 +771,9 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 781 | 8055, | 771 | 8055, |
| 782 | None, | 772 | None, |
| 783 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 773 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 784 | relay.respond_events( | 774 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 785 | client_id, | 775 | generate_repo_ref_event(), |
| 786 | &subscription_id, | 776 | ])?; |
| 787 | &vec![generate_repo_ref_event()], | ||
| 788 | )?; | ||
| 789 | Ok(()) | 777 | Ok(()) |
| 790 | }), | 778 | }), |
| 791 | ), | 779 | ), |
| @@ -844,14 +832,10 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 844 | 8051, | 832 | 8051, |
| 845 | None, | 833 | None, |
| 846 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 834 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 847 | relay.respond_events( | 835 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 848 | client_id, | 836 | generate_test_key_1_metadata_event("fred"), |
| 849 | &subscription_id, | 837 | generate_test_key_1_relay_list_event(), |
| 850 | &vec![ | 838 | ])?; |
| 851 | generate_test_key_1_metadata_event("fred"), | ||
| 852 | generate_test_key_1_relay_list_event(), | ||
| 853 | ], | ||
| 854 | )?; | ||
| 855 | Ok(()) | 839 | Ok(()) |
| 856 | }), | 840 | }), |
| 857 | ), | 841 | ), |
| @@ -861,11 +845,9 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 861 | 8055, | 845 | 8055, |
| 862 | None, | 846 | None, |
| 863 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 847 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 864 | relay.respond_events( | 848 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 865 | client_id, | 849 | generate_repo_ref_event(), |
| 866 | &subscription_id, | 850 | ])?; |
| 867 | &vec![generate_repo_ref_event()], | ||
| 868 | )?; | ||
| 869 | Ok(()) | 851 | Ok(()) |
| 870 | }), | 852 | }), |
| 871 | ), | 853 | ), |
| @@ -918,14 +900,10 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 918 | 8051, | 900 | 8051, |
| 919 | None, | 901 | None, |
| 920 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 902 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 921 | relay.respond_events( | 903 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 922 | client_id, | 904 | generate_test_key_1_metadata_event("fred"), |
| 923 | &subscription_id, | 905 | generate_test_key_1_relay_list_event(), |
| 924 | &vec![ | 906 | ])?; |
| 925 | generate_test_key_1_metadata_event("fred"), | ||
| 926 | generate_test_key_1_relay_list_event(), | ||
| 927 | ], | ||
| 928 | )?; | ||
| 929 | Ok(()) | 907 | Ok(()) |
| 930 | }), | 908 | }), |
| 931 | ), | 909 | ), |
| @@ -935,11 +913,9 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 935 | 8055, | 913 | 8055, |
| 936 | None, | 914 | None, |
| 937 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 915 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 938 | relay.respond_events( | 916 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 939 | client_id, | 917 | generate_repo_ref_event(), |
| 940 | &subscription_id, | 918 | ])?; |
| 941 | &vec![generate_repo_ref_event()], | ||
| 942 | )?; | ||
| 943 | Ok(()) | 919 | Ok(()) |
| 944 | }), | 920 | }), |
| 945 | ), | 921 | ), |
| @@ -1012,14 +988,10 @@ mod when_no_cover_letter_flag_set_with_range_of_head_2_sends_2_patches_without_c | |||
| 1012 | 8051, | 988 | 8051, |
| 1013 | None, | 989 | None, |
| 1014 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 990 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1015 | relay.respond_events( | 991 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1016 | client_id, | 992 | generate_test_key_1_metadata_event("fred"), |
| 1017 | &subscription_id, | 993 | generate_test_key_1_relay_list_event(), |
| 1018 | &vec![ | 994 | ])?; |
| 1019 | generate_test_key_1_metadata_event("fred"), | ||
| 1020 | generate_test_key_1_relay_list_event(), | ||
| 1021 | ], | ||
| 1022 | )?; | ||
| 1023 | Ok(()) | 995 | Ok(()) |
| 1024 | }), | 996 | }), |
| 1025 | ), | 997 | ), |
| @@ -1029,11 +1001,9 @@ mod when_no_cover_letter_flag_set_with_range_of_head_2_sends_2_patches_without_c | |||
| 1029 | 8055, | 1001 | 8055, |
| 1030 | None, | 1002 | None, |
| 1031 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1003 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1032 | relay.respond_events( | 1004 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1033 | client_id, | 1005 | generate_repo_ref_event(), |
| 1034 | &subscription_id, | 1006 | ])?; |
| 1035 | &vec![generate_repo_ref_event()], | ||
| 1036 | )?; | ||
| 1037 | Ok(()) | 1007 | Ok(()) |
| 1038 | }), | 1008 | }), |
| 1039 | ), | 1009 | ), |
| @@ -1200,16 +1170,13 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1200 | fn expect_msgs_first(p: &mut CliTester) -> Result<()> { | 1170 | fn expect_msgs_first(p: &mut CliTester) -> Result<()> { |
| 1201 | p.expect("fetching updates...\r\n")?; | 1171 | p.expect("fetching updates...\r\n")?; |
| 1202 | p.expect_eventually("\r\n")?; // may be 'no updates' or some updates | 1172 | p.expect_eventually("\r\n")?; // may be 'no updates' or some updates |
| 1203 | let mut selector = p.expect_multi_select( | 1173 | let mut selector = p.expect_multi_select("select commits for proposal", vec![ |
| 1204 | "select commits for proposal", | 1174 | "(Joe Bloggs) add t4.md [feature] fe973a8".to_string(), |
| 1205 | vec![ | 1175 | "(Joe Bloggs) add t3.md 232efb3".to_string(), |
| 1206 | "(Joe Bloggs) add t4.md [feature] fe973a8".to_string(), | 1176 | "(Joe Bloggs) add t2.md [main] 431b84e".to_string(), |
| 1207 | "(Joe Bloggs) add t3.md 232efb3".to_string(), | 1177 | "(Joe Bloggs) add t1.md af474d8".to_string(), |
| 1208 | "(Joe Bloggs) add t2.md [main] 431b84e".to_string(), | 1178 | "(Joe Bloggs) Initial commit 9ee507f".to_string(), |
| 1209 | "(Joe Bloggs) add t1.md af474d8".to_string(), | 1179 | ])?; |
| 1210 | "(Joe Bloggs) Initial commit 9ee507f".to_string(), | ||
| 1211 | ], | ||
| 1212 | )?; | ||
| 1213 | selector.succeeds_with(vec![0, 1], false, vec![0, 1])?; | 1180 | selector.succeeds_with(vec![0, 1], false, vec![0, 1])?; |
| 1214 | p.expect("creating proposal from 2 commits:\r\n")?; | 1181 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 1215 | p.expect("fe973a8 add t4.md\r\n")?; | 1182 | p.expect("fe973a8 add t4.md\r\n")?; |
| @@ -1234,14 +1201,10 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1234 | 8051, | 1201 | 8051, |
| 1235 | None, | 1202 | None, |
| 1236 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1203 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1237 | relay.respond_events( | 1204 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1238 | client_id, | 1205 | generate_test_key_1_metadata_event("fred"), |
| 1239 | &subscription_id, | 1206 | generate_test_key_1_relay_list_event(), |
| 1240 | &vec![ | 1207 | ])?; |
| 1241 | generate_test_key_1_metadata_event("fred"), | ||
| 1242 | generate_test_key_1_relay_list_event(), | ||
| 1243 | ], | ||
| 1244 | )?; | ||
| 1245 | Ok(()) | 1208 | Ok(()) |
| 1246 | }), | 1209 | }), |
| 1247 | ), | 1210 | ), |
| @@ -1251,11 +1214,9 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1251 | 8055, | 1214 | 8055, |
| 1252 | None, | 1215 | None, |
| 1253 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1216 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1254 | relay.respond_events( | 1217 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1255 | client_id, | 1218 | generate_repo_ref_event(), |
| 1256 | &subscription_id, | 1219 | ])?; |
| 1257 | &vec![generate_repo_ref_event()], | ||
| 1258 | )?; | ||
| 1259 | Ok(()) | 1220 | Ok(()) |
| 1260 | }), | 1221 | }), |
| 1261 | ), | 1222 | ), |
| @@ -1297,14 +1258,10 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1297 | 8051, | 1258 | 8051, |
| 1298 | None, | 1259 | None, |
| 1299 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1260 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1300 | relay.respond_events( | 1261 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1301 | client_id, | 1262 | generate_test_key_1_metadata_event("fred"), |
| 1302 | &subscription_id, | 1263 | generate_test_key_1_relay_list_event(), |
| 1303 | &vec![ | 1264 | ])?; |
| 1304 | generate_test_key_1_metadata_event("fred"), | ||
| 1305 | generate_test_key_1_relay_list_event(), | ||
| 1306 | ], | ||
| 1307 | )?; | ||
| 1308 | Ok(()) | 1265 | Ok(()) |
| 1309 | }), | 1266 | }), |
| 1310 | ), | 1267 | ), |
| @@ -1314,11 +1271,9 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1314 | 8055, | 1271 | 8055, |
| 1315 | None, | 1272 | None, |
| 1316 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1273 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1317 | relay.respond_events( | 1274 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1318 | client_id, | 1275 | generate_repo_ref_event(), |
| 1319 | &subscription_id, | 1276 | ])?; |
| 1320 | &vec![generate_repo_ref_event()], | ||
| 1321 | )?; | ||
| 1322 | Ok(()) | 1277 | Ok(()) |
| 1323 | }), | 1278 | }), |
| 1324 | ), | 1279 | ), |
| @@ -1435,15 +1390,11 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1435 | 8051, | 1390 | 8051, |
| 1436 | None, | 1391 | None, |
| 1437 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1392 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1438 | relay.respond_events( | 1393 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1439 | client_id, | 1394 | generate_test_key_1_metadata_event("fred"), |
| 1440 | &subscription_id, | 1395 | generate_test_key_1_relay_list_event(), |
| 1441 | &vec![ | 1396 | get_pretend_proposal_root_event(), |
| 1442 | generate_test_key_1_metadata_event("fred"), | 1397 | ])?; |
| 1443 | generate_test_key_1_relay_list_event(), | ||
| 1444 | get_pretend_proposal_root_event(), | ||
| 1445 | ], | ||
| 1446 | )?; | ||
| 1447 | Ok(()) | 1398 | Ok(()) |
| 1448 | }), | 1399 | }), |
| 1449 | ), | 1400 | ), |
| @@ -1453,11 +1404,10 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1453 | 8055, | 1404 | 8055, |
| 1454 | None, | 1405 | None, |
| 1455 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1406 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1456 | relay.respond_events( | 1407 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1457 | client_id, | 1408 | generate_repo_ref_event(), |
| 1458 | &subscription_id, | 1409 | get_pretend_proposal_root_event(), |
| 1459 | &vec![generate_repo_ref_event(), get_pretend_proposal_root_event()], | 1410 | ])?; |
| 1460 | )?; | ||
| 1461 | Ok(()) | 1411 | Ok(()) |
| 1462 | }), | 1412 | }), |
| 1463 | ), | 1413 | ), |
| @@ -1498,15 +1448,11 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1498 | 8051, | 1448 | 8051, |
| 1499 | None, | 1449 | None, |
| 1500 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1450 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1501 | relay.respond_events( | 1451 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1502 | client_id, | 1452 | generate_test_key_1_metadata_event("fred"), |
| 1503 | &subscription_id, | 1453 | generate_test_key_1_relay_list_event(), |
| 1504 | &vec![ | 1454 | get_pretend_proposal_root_event(), |
| 1505 | generate_test_key_1_metadata_event("fred"), | 1455 | ])?; |
| 1506 | generate_test_key_1_relay_list_event(), | ||
| 1507 | get_pretend_proposal_root_event(), | ||
| 1508 | ], | ||
| 1509 | )?; | ||
| 1510 | Ok(()) | 1456 | Ok(()) |
| 1511 | }), | 1457 | }), |
| 1512 | ), | 1458 | ), |
| @@ -1516,11 +1462,10 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1516 | 8055, | 1462 | 8055, |
| 1517 | None, | 1463 | None, |
| 1518 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1464 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1519 | relay.respond_events( | 1465 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1520 | client_id, | 1466 | generate_repo_ref_event(), |
| 1521 | &subscription_id, | 1467 | get_pretend_proposal_root_event(), |
| 1522 | &vec![generate_repo_ref_event(), get_pretend_proposal_root_event()], | 1468 | ])?; |
| 1523 | )?; | ||
| 1524 | Ok(()) | 1469 | Ok(()) |
| 1525 | }), | 1470 | }), |
| 1526 | ), | 1471 | ), |
| @@ -1697,15 +1642,11 @@ mod in_reply_to_mentions_issue { | |||
| 1697 | 8051, | 1642 | 8051, |
| 1698 | None, | 1643 | None, |
| 1699 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1644 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1700 | relay.respond_events( | 1645 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1701 | client_id, | 1646 | generate_test_key_1_metadata_event("fred"), |
| 1702 | &subscription_id, | 1647 | generate_test_key_1_relay_list_event(), |
| 1703 | &vec![ | 1648 | get_pretend_issue_event(), |
| 1704 | generate_test_key_1_metadata_event("fred"), | 1649 | ])?; |
| 1705 | generate_test_key_1_relay_list_event(), | ||
| 1706 | get_pretend_issue_event(), | ||
| 1707 | ], | ||
| 1708 | )?; | ||
| 1709 | Ok(()) | 1650 | Ok(()) |
| 1710 | }), | 1651 | }), |
| 1711 | ), | 1652 | ), |
| @@ -1715,11 +1656,10 @@ mod in_reply_to_mentions_issue { | |||
| 1715 | 8055, | 1656 | 8055, |
| 1716 | None, | 1657 | None, |
| 1717 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1658 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1718 | relay.respond_events( | 1659 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1719 | client_id, | 1660 | generate_repo_ref_event(), |
| 1720 | &subscription_id, | 1661 | get_pretend_issue_event(), |
| 1721 | &vec![generate_repo_ref_event(), get_pretend_issue_event()], | 1662 | ])?; |
| 1722 | )?; | ||
| 1723 | Ok(()) | 1663 | Ok(()) |
| 1724 | }), | 1664 | }), |
| 1725 | ), | 1665 | ), |
| @@ -1821,14 +1761,10 @@ mod in_reply_to_mentions_npub_and_nprofile_which_get_mentioned_in_proposal_root | |||
| 1821 | 8051, | 1761 | 8051, |
| 1822 | None, | 1762 | None, |
| 1823 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1763 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1824 | relay.respond_events( | 1764 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1825 | client_id, | 1765 | generate_test_key_1_metadata_event("fred"), |
| 1826 | &subscription_id, | 1766 | generate_test_key_1_relay_list_event(), |
| 1827 | &vec![ | 1767 | ])?; |
| 1828 | generate_test_key_1_metadata_event("fred"), | ||
| 1829 | generate_test_key_1_relay_list_event(), | ||
| 1830 | ], | ||
| 1831 | )?; | ||
| 1832 | Ok(()) | 1768 | Ok(()) |
| 1833 | }), | 1769 | }), |
| 1834 | ), | 1770 | ), |
| @@ -1838,11 +1774,9 @@ mod in_reply_to_mentions_npub_and_nprofile_which_get_mentioned_in_proposal_root | |||
| 1838 | 8055, | 1774 | 8055, |
| 1839 | None, | 1775 | None, |
| 1840 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { | 1776 | Some(&|relay, client_id, subscription_id, _| -> Result<()> { |
| 1841 | relay.respond_events( | 1777 | relay.respond_events(client_id, &subscription_id, &vec![ |
| 1842 | client_id, | 1778 | generate_repo_ref_event(), |
| 1843 | &subscription_id, | 1779 | ])?; |
| 1844 | &vec![generate_repo_ref_event()], | ||
| 1845 | )?; | ||
| 1846 | Ok(()) | 1780 | Ok(()) |
| 1847 | }), | 1781 | }), |
| 1848 | ), | 1782 | ), |