diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-17 10:53:20 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-17 10:53:20 +0100 |
| commit | 43a445963968dac7da190b56f7c89ac0ff1f6abd (patch) | |
| tree | 3c58f17c53de3f6ccc888323d677da12402a7891 /tests | |
| parent | 65d5daf6e42683ef116369b4f6a0f99d6971667b (diff) | |
feat(login): use fetch to get user profile
fetch automatically gets updates to logged in user profile / relays
fetching without specifying repo pointers will just fetch user
profiles so that can be used during login, if user profile isn't
in cache
login now uses fetch
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/init.rs | 2 | ||||
| -rw-r--r-- | tests/login.rs | 20 | ||||
| -rw-r--r-- | tests/push.rs | 4 | ||||
| -rw-r--r-- | tests/send.rs | 6 |
4 files changed, 15 insertions, 17 deletions
diff --git a/tests/init.rs b/tests/init.rs index c7f26c4..d7ba164 100644 --- a/tests/init.rs +++ b/tests/init.rs | |||
| @@ -3,7 +3,7 @@ use serial_test::serial; | |||
| 3 | use test_utils::{git::GitTestRepo, *}; | 3 | use test_utils::{git::GitTestRepo, *}; |
| 4 | 4 | ||
| 5 | fn expect_msgs_first(p: &mut CliTester) -> Result<()> { | 5 | fn expect_msgs_first(p: &mut CliTester) -> Result<()> { |
| 6 | p.expect("searching for profile and relay updates...\r\n")?; | 6 | p.expect("searching for profile...\r\n")?; |
| 7 | p.expect("logged in as fred\r\n")?; | 7 | p.expect("logged in as fred\r\n")?; |
| 8 | // // p.expect("searching for existing claims on repository...\r\n")?; | 8 | // // p.expect("searching for existing claims on repository...\r\n")?; |
| 9 | p.expect("publishing repostory reference...\r\n")?; | 9 | p.expect("publishing repostory reference...\r\n")?; |
diff --git a/tests/login.rs b/tests/login.rs index 4cc2dbe..3bcfbf9 100644 --- a/tests/login.rs +++ b/tests/login.rs | |||
| @@ -73,7 +73,7 @@ mod with_relays { | |||
| 73 | 73 | ||
| 74 | p.expect("saved login details to local git config\r\n")?; | 74 | p.expect("saved login details to local git config\r\n")?; |
| 75 | 75 | ||
| 76 | p.expect("searching for profile and relay updates...\r\n")?; | 76 | p.expect("searching for profile...\r\n")?; |
| 77 | 77 | ||
| 78 | p.expect_end_with("logged in as fred\r\n")?; | 78 | p.expect_end_with("logged in as fred\r\n")?; |
| 79 | for p in [51, 52] { | 79 | for p in [51, 52] { |
| @@ -113,7 +113,7 @@ mod with_relays { | |||
| 113 | 113 | ||
| 114 | p.expect("saved login details to local git config\r\n")?; | 114 | p.expect("saved login details to local git config\r\n")?; |
| 115 | 115 | ||
| 116 | p.expect("searching for profile and relay updates...\r\n")?; | 116 | p.expect("searching for profile...\r\n")?; |
| 117 | 117 | ||
| 118 | p.expect("cannot extract account name from account metadata...\r\n")?; | 118 | p.expect("cannot extract account name from account metadata...\r\n")?; |
| 119 | 119 | ||
| @@ -422,7 +422,7 @@ mod with_relays { | |||
| 422 | 422 | ||
| 423 | p.expect("saved login details to local git config\r\n")?; | 423 | p.expect("saved login details to local git config\r\n")?; |
| 424 | 424 | ||
| 425 | p.expect("searching for profile and relay updates...\r\n")?; | 425 | p.expect("searching for profile...\r\n")?; |
| 426 | 426 | ||
| 427 | p.expect_end_with("logged in as fred\r\n")?; | 427 | p.expect_end_with("logged in as fred\r\n")?; |
| 428 | for p in [51, 52] { | 428 | for p in [51, 52] { |
| @@ -489,7 +489,7 @@ mod with_relays { | |||
| 489 | ["login", "--password", TEST_PASSWORD], | 489 | ["login", "--password", TEST_PASSWORD], |
| 490 | ); | 490 | ); |
| 491 | 491 | ||
| 492 | p.expect("searching for profile and relay updates...\r\n")?; | 492 | p.expect("searching for profile...\r\n")?; |
| 493 | 493 | ||
| 494 | p.expect_end_with("logged in as fred\r\n")?; | 494 | p.expect_end_with("logged in as fred\r\n")?; |
| 495 | for p in [51, 52] { | 495 | for p in [51, 52] { |
| @@ -551,7 +551,7 @@ mod with_relays { | |||
| 551 | 551 | ||
| 552 | p.expect("saved login details to local git config\r\n")?; | 552 | p.expect("saved login details to local git config\r\n")?; |
| 553 | 553 | ||
| 554 | p.expect("searching for profile and relay updates...\r\n")?; | 554 | p.expect("searching for profile...\r\n")?; |
| 555 | 555 | ||
| 556 | p.expect_end_with("logged in as fred\r\n")?; | 556 | p.expect_end_with("logged in as fred\r\n")?; |
| 557 | for p in [51, 52] { | 557 | for p in [51, 52] { |
| @@ -602,9 +602,9 @@ mod with_relays { | |||
| 602 | 602 | ||
| 603 | p.expect("saved login details to local git config\r\n")?; | 603 | p.expect("saved login details to local git config\r\n")?; |
| 604 | 604 | ||
| 605 | p.expect("searching for profile and relay updates...\r\n")?; | 605 | p.expect("searching for profile...\r\n")?; |
| 606 | 606 | ||
| 607 | p.expect("cannot find your account metadata (name, etc) on relays\r\n")?; | 607 | p.expect("cannot find profile...\r\n")?; |
| 608 | 608 | ||
| 609 | p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; | 609 | p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; |
| 610 | for p in [51, 52] { | 610 | for p in [51, 52] { |
| @@ -665,7 +665,7 @@ mod with_relays { | |||
| 665 | 665 | ||
| 666 | p.expect("saved login details to local git config\r\n")?; | 666 | p.expect("saved login details to local git config\r\n")?; |
| 667 | 667 | ||
| 668 | p.expect("searching for profile and relay updates...\r\n")?; | 668 | p.expect("searching for profile...\r\n")?; |
| 669 | 669 | ||
| 670 | p.expect("cannot find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; | 670 | p.expect("cannot find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; |
| 671 | 671 | ||
| @@ -743,8 +743,6 @@ mod with_relays { | |||
| 743 | ["login", "--password", TEST_PASSWORD], | 743 | ["login", "--password", TEST_PASSWORD], |
| 744 | ); | 744 | ); |
| 745 | 745 | ||
| 746 | p.expect("searching for profile and relay updates...\r\n")?; | ||
| 747 | |||
| 748 | p.expect_end_eventually_with("logged in as fred\r\n")?; | 746 | p.expect_end_eventually_with("logged in as fred\r\n")?; |
| 749 | 747 | ||
| 750 | Ok(()) | 748 | Ok(()) |
| @@ -790,7 +788,7 @@ mod with_relays { | |||
| 790 | 788 | ||
| 791 | p.expect("saved login details to local git config\r\n")?; | 789 | p.expect("saved login details to local git config\r\n")?; |
| 792 | 790 | ||
| 793 | p.expect("searching for profile and relay updates...\r\n")?; | 791 | p.expect("searching for profile...\r\n")?; |
| 794 | 792 | ||
| 795 | p.expect_end_with("logged in as fred\r\n")?; | 793 | p.expect_end_with("logged in as fred\r\n")?; |
| 796 | for p in [51, 52, 53, 55] { | 794 | for p in [51, 52, 53, 55] { |
diff --git a/tests/push.rs b/tests/push.rs index fe711c1..65c92e9 100644 --- a/tests/push.rs +++ b/tests/push.rs | |||
| @@ -346,7 +346,7 @@ mod when_branch_is_checked_out { | |||
| 346 | p.expect( | 346 | p.expect( |
| 347 | "1 commits ahead. preparing to create creating patch events.\r\n", | 347 | "1 commits ahead. preparing to create creating patch events.\r\n", |
| 348 | )?; | 348 | )?; |
| 349 | p.expect("searching for profile and relay updates...\r\n")?; | 349 | p.expect("searching for profile...\r\n")?; |
| 350 | p.expect("logged in as fred\r\n")?; | 350 | p.expect("logged in as fred\r\n")?; |
| 351 | p.expect("pushing 1 commits\r\n")?; | 351 | p.expect("pushing 1 commits\r\n")?; |
| 352 | 352 | ||
| @@ -591,7 +591,7 @@ mod when_branch_is_checked_out { | |||
| 591 | p.expect("creating proposal from 2 commits:\r\n")?; | 591 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 592 | p.expect("355bdf1 add a4.md\r\n")?; | 592 | p.expect("355bdf1 add a4.md\r\n")?; |
| 593 | p.expect("dbd1115 add a3.md\r\n")?; | 593 | p.expect("dbd1115 add a3.md\r\n")?; |
| 594 | p.expect("searching for profile and relay updates...\r\n")?; | 594 | p.expect("searching for profile...\r\n")?; |
| 595 | p.expect("logged in as fred\r\n")?; | 595 | p.expect("logged in as fred\r\n")?; |
| 596 | p.expect("posting 2 patches without a covering letter...\r\n")?; | 596 | p.expect("posting 2 patches without a covering letter...\r\n")?; |
| 597 | 597 | ||
diff --git a/tests/send.rs b/tests/send.rs index 0169c82..87bd54f 100644 --- a/tests/send.rs +++ b/tests/send.rs | |||
| @@ -133,7 +133,7 @@ fn expect_msgs_first(p: &mut CliTester, include_cover_letter: bool) -> Result<() | |||
| 133 | p.expect("creating proposal from 2 commits:\r\n")?; | 133 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 134 | p.expect("fe973a8 add t4.md\r\n")?; | 134 | p.expect("fe973a8 add t4.md\r\n")?; |
| 135 | p.expect("232efb3 add t3.md\r\n")?; | 135 | p.expect("232efb3 add t3.md\r\n")?; |
| 136 | p.expect("searching for profile and relay updates...\r\n")?; | 136 | p.expect("searching for profile...\r\n")?; |
| 137 | p.expect("logged in as fred\r\n")?; | 137 | p.expect("logged in as fred\r\n")?; |
| 138 | p.expect(format!( | 138 | p.expect(format!( |
| 139 | "posting 2 patches {} a covering letter...\r\n", | 139 | "posting 2 patches {} a covering letter...\r\n", |
| @@ -1173,7 +1173,7 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { | |||
| 1173 | p.expect("creating proposal from 2 commits:\r\n")?; | 1173 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 1174 | p.expect("fe973a8 add t4.md\r\n")?; | 1174 | p.expect("fe973a8 add t4.md\r\n")?; |
| 1175 | p.expect("232efb3 add t3.md\r\n")?; | 1175 | p.expect("232efb3 add t3.md\r\n")?; |
| 1176 | p.expect("searching for profile and relay updates...\r\n")?; | 1176 | p.expect("searching for profile...\r\n")?; |
| 1177 | p.expect("logged in as fred\r\n")?; | 1177 | p.expect("logged in as fred\r\n")?; |
| 1178 | p.expect("posting 2 patches without a covering letter...\r\n")?; | 1178 | p.expect("posting 2 patches without a covering letter...\r\n")?; |
| 1179 | Ok(()) | 1179 | Ok(()) |
| @@ -1367,7 +1367,7 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let | |||
| 1367 | p.expect("creating proposal from 2 commits:\r\n")?; | 1367 | p.expect("creating proposal from 2 commits:\r\n")?; |
| 1368 | p.expect("fe973a8 add t4.md\r\n")?; | 1368 | p.expect("fe973a8 add t4.md\r\n")?; |
| 1369 | p.expect("232efb3 add t3.md\r\n")?; | 1369 | p.expect("232efb3 add t3.md\r\n")?; |
| 1370 | p.expect("searching for profile and relay updates...\r\n")?; | 1370 | p.expect("searching for profile...\r\n")?; |
| 1371 | p.expect("logged in as fred\r\n")?; | 1371 | p.expect("logged in as fred\r\n")?; |
| 1372 | p.expect(format!( | 1372 | p.expect(format!( |
| 1373 | "posting 2 patches {} a covering letter...\r\n", | 1373 | "posting 2 patches {} a covering letter...\r\n", |