diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-19 20:38:00 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-19 20:38:00 +0100 |
| commit | ab1214060a7a2d55068a7ccc9c7f6a04fd7d5aa2 (patch) | |
| tree | e561bcc093d393c2d7056a6d6c5f52e886eead27 /tests/send.rs | |
| parent | 2e54dd09a1a3b42903eee00adf4472d8b679dcb1 (diff) | |
feat: intergrate `fetch` into `send`
reworking the tests and test suite as appropriate
Diffstat (limited to 'tests/send.rs')
| -rw-r--r-- | tests/send.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/send.rs b/tests/send.rs index 87bd54f..0f18bd1 100644 --- a/tests/send.rs +++ b/tests/send.rs | |||
| @@ -37,6 +37,8 @@ mod when_commits_behind_ask_to_proceed { | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | fn expect_confirm_prompt(p: &mut CliTester) -> Result<CliTesterConfirmPrompt> { | 39 | fn expect_confirm_prompt(p: &mut CliTester) -> Result<CliTesterConfirmPrompt> { |
| 40 | p.expect("fetching updates...\r\n")?; | ||
| 41 | p.expect_eventually("\r\n")?; // may be 'no updates' or some updates | ||
| 40 | p.expect("creating proposal from 2 commits:\r\n")?; | 42 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 41 | p.expect("fe973a8 add t4.md\r\n")?; | 43 | p.expect("fe973a8 add t4.md\r\n")?; |
| 42 | p.expect("232efb3 add t3.md\r\n")?; | 44 | p.expect("232efb3 add t3.md\r\n")?; |
| @@ -130,11 +132,13 @@ fn cli_tester_create_proposal(git_repo: &GitTestRepo, include_cover_letter: bool | |||
| 130 | } | 132 | } |
| 131 | 133 | ||
| 132 | fn expect_msgs_first(p: &mut CliTester, include_cover_letter: bool) -> Result<()> { | 134 | fn expect_msgs_first(p: &mut CliTester, include_cover_letter: bool) -> Result<()> { |
| 135 | p.expect("fetching updates...\r\n")?; | ||
| 136 | p.expect_eventually("\r\n")?; // may be 'no updates' or some updates | ||
| 133 | p.expect("creating proposal from 2 commits:\r\n")?; | 137 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 134 | p.expect("fe973a8 add t4.md\r\n")?; | 138 | p.expect("fe973a8 add t4.md\r\n")?; |
| 135 | p.expect("232efb3 add t3.md\r\n")?; | 139 | p.expect("232efb3 add t3.md\r\n")?; |
| 136 | p.expect("searching for profile...\r\n")?; | 140 | // sometimes there will be a 'searching for profile...' msg |
| 137 | p.expect("logged in as fred\r\n")?; | 141 | p.expect_eventually("logged in as fred\r\n")?; |
| 138 | p.expect(format!( | 142 | p.expect(format!( |
| 139 | "posting 2 patches {} a covering letter...\r\n", | 143 | "posting 2 patches {} a covering letter...\r\n", |
| 140 | if include_cover_letter { | 144 | if include_cover_letter { |
| @@ -921,7 +925,6 @@ mod when_cover_letter_details_specified_with_range_of_head_2_sends_cover_letter_ | |||
| 921 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 925 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 922 | let mut p = cli_tester_create_proposal(&git_repo, true); | 926 | let mut p = cli_tester_create_proposal(&git_repo, true); |
| 923 | expect_msgs_first(&mut p, true)?; | 927 | expect_msgs_first(&mut p, true)?; |
| 924 | // p.expect_end_with("bla")?; | ||
| 925 | relay::expect_send_with_progress( | 928 | relay::expect_send_with_progress( |
| 926 | &mut p, | 929 | &mut p, |
| 927 | vec![ | 930 | vec![ |
| @@ -1159,6 +1162,8 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1159 | CliTester::new_from_dir(&git_repo.dir, args) | 1162 | CliTester::new_from_dir(&git_repo.dir, args) |
| 1160 | } | 1163 | } |
| 1161 | fn expect_msgs_first(p: &mut CliTester) -> Result<()> { | 1164 | fn expect_msgs_first(p: &mut CliTester) -> Result<()> { |
| 1165 | p.expect("fetching updates...\r\n")?; | ||
| 1166 | p.expect_eventually("\r\n")?; // may be 'no updates' or some updates | ||
| 1162 | let mut selector = p.expect_multi_select( | 1167 | let mut selector = p.expect_multi_select( |
| 1163 | "select commits for proposal", | 1168 | "select commits for proposal", |
| 1164 | vec![ | 1169 | vec![ |
| @@ -1349,7 +1354,6 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1349 | "HEAD~2", | 1354 | "HEAD~2", |
| 1350 | "--in-reply-to", | 1355 | "--in-reply-to", |
| 1351 | &proposal_root_bech32, | 1356 | &proposal_root_bech32, |
| 1352 | // "nevent1qqsged665nx6zz36puey9hzf6ds4n5ctxxzm7c6pfnmvu9l4c9988vgzyr6nuj7d02wdauzfeajx043c5yepjk9v6wm3avycy07kltdsy0tksh0zxyx", | ||
| 1353 | "--title", | 1357 | "--title", |
| 1354 | "exampletitle", | 1358 | "exampletitle", |
| 1355 | "--description", | 1359 | "--description", |
| @@ -1358,16 +1362,16 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1358 | CliTester::new_from_dir(&git_repo.dir, args) | 1362 | CliTester::new_from_dir(&git_repo.dir, args) |
| 1359 | } | 1363 | } |
| 1360 | fn expect_msgs_first(p: &mut CliTester, include_cover_letter: bool) -> Result<()> { | 1364 | fn expect_msgs_first(p: &mut CliTester, include_cover_letter: bool) -> Result<()> { |
| 1365 | p.expect("fetching updates...\r\n")?; | ||
| 1366 | p.expect("updates: 1 new maintainer, 1 announcement update, 1 proposal\r\n")?; | ||
| 1361 | let proposal_root_bech32 = get_pretend_proposal_root_event().id.to_bech32().unwrap(); | 1367 | let proposal_root_bech32 = get_pretend_proposal_root_event().id.to_bech32().unwrap(); |
| 1362 | p.expect(format!( | 1368 | p.expect(format!( |
| 1363 | "creating proposal revision for: {}\r\n", | 1369 | "creating proposal revision for: {}\r\n", |
| 1364 | proposal_root_bech32, | 1370 | proposal_root_bech32, |
| 1365 | ))?; | 1371 | ))?; |
| 1366 | // p.expect("creating proposal revision for: nevent1qqsged665nx6zz36puey9hzf6ds4n5ctxxzm7c6pfnmvu9l4c9988vgzyr6nuj7d02wdauzfeajx043c5yepjk9v6wm3avycy07kltdsy0tksh0zxyx\r\n")?; | ||
| 1367 | p.expect("creating proposal from 2 commits:\r\n")?; | 1372 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 1368 | p.expect("fe973a8 add t4.md\r\n")?; | 1373 | p.expect("fe973a8 add t4.md\r\n")?; |
| 1369 | p.expect("232efb3 add t3.md\r\n")?; | 1374 | p.expect("232efb3 add t3.md\r\n")?; |
| 1370 | p.expect("searching for profile...\r\n")?; | ||
| 1371 | p.expect("logged in as fred\r\n")?; | 1375 | p.expect("logged in as fred\r\n")?; |
| 1372 | p.expect(format!( | 1376 | p.expect(format!( |
| 1373 | "posting 2 patches {} a covering letter...\r\n", | 1377 | "posting 2 patches {} a covering letter...\r\n", |
| @@ -1574,7 +1578,7 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1574 | .unwrap() | 1578 | .unwrap() |
| 1575 | .as_vec()[1], | 1579 | .as_vec()[1], |
| 1576 | // id of state nevent | 1580 | // id of state nevent |
| 1577 | "8cb75aa4cda10a3a0f3242dc49d36159d30b3185bf63414cf6ce17f5c14a73b1", | 1581 | "431e58eb8e1b4e20292d1d5bbe81d5cfb042e1bc165de32eddfdd52245a4cce4", |
| 1578 | ); | 1582 | ); |
| 1579 | } | 1583 | } |
| 1580 | Ok(()) | 1584 | Ok(()) |
| @@ -1620,7 +1624,7 @@ mod in_reply_to_mentions_issue { | |||
| 1620 | } | 1624 | } |
| 1621 | 1625 | ||
| 1622 | fn cli_tester_create_proposal(git_repo: &GitTestRepo) -> CliTester { | 1626 | fn cli_tester_create_proposal(git_repo: &GitTestRepo) -> CliTester { |
| 1623 | let proposal_root_bech32 = get_pretend_issue_event().id.to_bech32().unwrap(); | 1627 | let issue_bech32 = get_pretend_issue_event().id.to_bech32().unwrap(); |
| 1624 | let args = vec![ | 1628 | let args = vec![ |
| 1625 | "--nsec", | 1629 | "--nsec", |
| 1626 | TEST_KEY_1_NSEC, | 1630 | TEST_KEY_1_NSEC, |
| @@ -1630,7 +1634,7 @@ mod in_reply_to_mentions_issue { | |||
| 1630 | "send", | 1634 | "send", |
| 1631 | "HEAD~2", | 1635 | "HEAD~2", |
| 1632 | "--in-reply-to", | 1636 | "--in-reply-to", |
| 1633 | &proposal_root_bech32, | 1637 | &issue_bech32, |
| 1634 | // "note1a9z8vhtzttnny0ggpksd7p5uwf4qu4ys59a52tu9fkz7rrmczkyqc46ngg", | 1638 | // "note1a9z8vhtzttnny0ggpksd7p5uwf4qu4ys59a52tu9fkz7rrmczkyqc46ngg", |
| 1635 | "--title", | 1639 | "--title", |
| 1636 | "exampletitle", | 1640 | "exampletitle", |
| @@ -1738,7 +1742,6 @@ mod in_reply_to_mentions_issue { | |||
| 1738 | } | 1742 | } |
| 1739 | } | 1743 | } |
| 1740 | mod in_reply_to_mentions_npub_and_nprofile_which_get_mentioned_in_proposal_root { | 1744 | mod in_reply_to_mentions_npub_and_nprofile_which_get_mentioned_in_proposal_root { |
| 1741 | use nostr::JsonUtil; | ||
| 1742 | 1745 | ||
| 1743 | use super::*; | 1746 | use super::*; |
| 1744 | 1747 | ||
| @@ -1835,7 +1838,6 @@ mod in_reply_to_mentions_npub_and_nprofile_which_get_mentioned_in_proposal_root | |||
| 1835 | for relay in [&r53, &r55, &r56] { | 1838 | for relay in [&r53, &r55, &r56] { |
| 1836 | let cover_letter_event: &nostr::Event = | 1839 | let cover_letter_event: &nostr::Event = |
| 1837 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 1840 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 1838 | println!("{:?}", &cover_letter_event.as_json()); | ||
| 1839 | assert!(cover_letter_event.iter_tags().any(|t| { | 1841 | assert!(cover_letter_event.iter_tags().any(|t| { |
| 1840 | t.as_vec()[0].eq("p") | 1842 | t.as_vec()[0].eq("p") |
| 1841 | && t.as_vec()[1].eq(&nostr::Keys::parse( | 1843 | && t.as_vec()[1].eq(&nostr::Keys::parse( |