From d1f1963a34ec66356e1b66c1fce937391dd126c3 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 9 Aug 2024 08:25:43 +0100 Subject: feat(remote): remove pr id postfix for authors remove the () post fix for remote proposal branches when the current user is the author this enables pushing new proposals without having to change the upstream branch in a way that remote helpers weren't designed to do --- tests/git_remote_helper.rs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/git_remote_helper.rs b/tests/git_remote_helper.rs index f768806..7cf6799 100644 --- a/tests/git_remote_helper.rs +++ b/tests/git_remote_helper.rs @@ -28,15 +28,20 @@ fn get_nostr_remote_url() -> Result { fn prep_git_repo() -> Result { let test_repo = GitTestRepo::without_repo_in_git_config(); + set_git_nostr_login_config(&test_repo)?; + test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; + test_repo.populate()?; + Ok(test_repo) +} + +fn set_git_nostr_login_config(test_repo: &GitTestRepo) -> Result<()> { let mut config = test_repo .git_repo .config() .context("cannot open git config")?; - config.set_str("nostr.nsec", TEST_KEY_1_NSEC)?; - config.set_str("nostr.npub", TEST_KEY_1_NPUB)?; - test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; - test_repo.populate()?; - Ok(test_repo) + config.set_str("nostr.nsec", TEST_KEY_2_NSEC)?; + config.set_str("nostr.npub", TEST_KEY_2_NPUB)?; + Ok(()) } fn clone_git_repo_with_nostr_url() -> Result { @@ -45,23 +50,13 @@ fn clone_git_repo_with_nostr_url() -> Result { CliTester::new_git_with_remote_helper_from_dir(&path, ["clone", &get_nostr_remote_url()?, "."]) .expect_end_eventually_and_print()?; let test_repo = GitTestRepo::open(&path)?; - let mut config = test_repo - .git_repo - .config() - .context("cannot open git config")?; - config.set_str("nostr.nsec", TEST_KEY_1_NSEC)?; - config.set_str("nostr.npub", TEST_KEY_1_NPUB)?; + set_git_nostr_login_config(&test_repo)?; Ok(test_repo) } fn prep_git_repo_minus_1_commit() -> Result { let test_repo = GitTestRepo::without_repo_in_git_config(); - let mut config = test_repo - .git_repo - .config() - .context("cannot open git config")?; - config.set_str("nostr.nsec", TEST_KEY_1_NSEC)?; - config.set_str("nostr.npub", TEST_KEY_1_NPUB)?; + set_git_nostr_login_config(&test_repo)?; test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; test_repo.populate_minus_1()?; Ok(test_repo) -- cgit v1.2.3