From 43a445963968dac7da190b56f7c89ac0ff1f6abd Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 17 Jul 2024 10:53:20 +0100 Subject: 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 --- tests/init.rs | 2 +- tests/login.rs | 20 +++++++++----------- tests/push.rs | 4 ++-- tests/send.rs | 6 +++--- 4 files changed, 15 insertions(+), 17 deletions(-) (limited to 'tests') 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; use test_utils::{git::GitTestRepo, *}; fn expect_msgs_first(p: &mut CliTester) -> Result<()> { - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("logged in as fred\r\n")?; // // p.expect("searching for existing claims on repository...\r\n")?; 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 { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect_end_with("logged in as fred\r\n")?; for p in [51, 52] { @@ -113,7 +113,7 @@ mod with_relays { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("cannot extract account name from account metadata...\r\n")?; @@ -422,7 +422,7 @@ mod with_relays { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect_end_with("logged in as fred\r\n")?; for p in [51, 52] { @@ -489,7 +489,7 @@ mod with_relays { ["login", "--password", TEST_PASSWORD], ); - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect_end_with("logged in as fred\r\n")?; for p in [51, 52] { @@ -551,7 +551,7 @@ mod with_relays { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect_end_with("logged in as fred\r\n")?; for p in [51, 52] { @@ -602,9 +602,9 @@ mod with_relays { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; - p.expect("cannot find your account metadata (name, etc) on relays\r\n")?; + p.expect("cannot find profile...\r\n")?; p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; for p in [51, 52] { @@ -665,7 +665,7 @@ mod with_relays { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("cannot find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; @@ -743,8 +743,6 @@ mod with_relays { ["login", "--password", TEST_PASSWORD], ); - p.expect("searching for profile and relay updates...\r\n")?; - p.expect_end_eventually_with("logged in as fred\r\n")?; Ok(()) @@ -790,7 +788,7 @@ mod with_relays { p.expect("saved login details to local git config\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect_end_with("logged in as fred\r\n")?; 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 { p.expect( "1 commits ahead. preparing to create creating patch events.\r\n", )?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("logged in as fred\r\n")?; p.expect("pushing 1 commits\r\n")?; @@ -591,7 +591,7 @@ mod when_branch_is_checked_out { p.expect("creating proposal from 2 commits:\r\n")?; p.expect("355bdf1 add a4.md\r\n")?; p.expect("dbd1115 add a3.md\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("logged in as fred\r\n")?; p.expect("posting 2 patches without a covering letter...\r\n")?; 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<() p.expect("creating proposal from 2 commits:\r\n")?; p.expect("fe973a8 add t4.md\r\n")?; p.expect("232efb3 add t3.md\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("logged in as fred\r\n")?; p.expect(format!( "posting 2 patches {} a covering letter...\r\n", @@ -1173,7 +1173,7 @@ mod when_range_ommited_prompts_for_selection_defaulting_ahead_of_main { p.expect("creating proposal from 2 commits:\r\n")?; p.expect("fe973a8 add t4.md\r\n")?; p.expect("232efb3 add t3.md\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("logged in as fred\r\n")?; p.expect("posting 2 patches without a covering letter...\r\n")?; Ok(()) @@ -1367,7 +1367,7 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let p.expect("creating proposal from 2 commits:\r\n")?; p.expect("fe973a8 add t4.md\r\n")?; p.expect("232efb3 add t3.md\r\n")?; - p.expect("searching for profile and relay updates...\r\n")?; + p.expect("searching for profile...\r\n")?; p.expect("logged in as fred\r\n")?; p.expect(format!( "posting 2 patches {} a covering letter...\r\n", -- cgit v1.2.3