diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-09 08:25:43 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-09 08:25:43 +0100 |
| commit | d1f1963a34ec66356e1b66c1fce937391dd126c3 (patch) | |
| tree | a3552831489013e5b3d31f5dce6b51403e62659f /tests | |
| parent | a556464452789dc72cb9b0bff8e9ba6addc6639a (diff) | |
feat(remote): remove pr id postfix for authors
remove the (<short id>) 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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/git_remote_helper.rs | 29 |
1 files changed, 12 insertions, 17 deletions
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<String> { | |||
| 28 | 28 | ||
| 29 | fn prep_git_repo() -> Result<GitTestRepo> { | 29 | fn prep_git_repo() -> Result<GitTestRepo> { |
| 30 | let test_repo = GitTestRepo::without_repo_in_git_config(); | 30 | let test_repo = GitTestRepo::without_repo_in_git_config(); |
| 31 | set_git_nostr_login_config(&test_repo)?; | ||
| 32 | test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; | ||
| 33 | test_repo.populate()?; | ||
| 34 | Ok(test_repo) | ||
| 35 | } | ||
| 36 | |||
| 37 | fn set_git_nostr_login_config(test_repo: &GitTestRepo) -> Result<()> { | ||
| 31 | let mut config = test_repo | 38 | let mut config = test_repo |
| 32 | .git_repo | 39 | .git_repo |
| 33 | .config() | 40 | .config() |
| 34 | .context("cannot open git config")?; | 41 | .context("cannot open git config")?; |
| 35 | config.set_str("nostr.nsec", TEST_KEY_1_NSEC)?; | 42 | config.set_str("nostr.nsec", TEST_KEY_2_NSEC)?; |
| 36 | config.set_str("nostr.npub", TEST_KEY_1_NPUB)?; | 43 | config.set_str("nostr.npub", TEST_KEY_2_NPUB)?; |
| 37 | test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; | 44 | Ok(()) |
| 38 | test_repo.populate()?; | ||
| 39 | Ok(test_repo) | ||
| 40 | } | 45 | } |
| 41 | 46 | ||
| 42 | fn clone_git_repo_with_nostr_url() -> Result<GitTestRepo> { | 47 | fn clone_git_repo_with_nostr_url() -> Result<GitTestRepo> { |
| @@ -45,23 +50,13 @@ fn clone_git_repo_with_nostr_url() -> Result<GitTestRepo> { | |||
| 45 | CliTester::new_git_with_remote_helper_from_dir(&path, ["clone", &get_nostr_remote_url()?, "."]) | 50 | CliTester::new_git_with_remote_helper_from_dir(&path, ["clone", &get_nostr_remote_url()?, "."]) |
| 46 | .expect_end_eventually_and_print()?; | 51 | .expect_end_eventually_and_print()?; |
| 47 | let test_repo = GitTestRepo::open(&path)?; | 52 | let test_repo = GitTestRepo::open(&path)?; |
| 48 | let mut config = test_repo | 53 | set_git_nostr_login_config(&test_repo)?; |
| 49 | .git_repo | ||
| 50 | .config() | ||
| 51 | .context("cannot open git config")?; | ||
| 52 | config.set_str("nostr.nsec", TEST_KEY_1_NSEC)?; | ||
| 53 | config.set_str("nostr.npub", TEST_KEY_1_NPUB)?; | ||
| 54 | Ok(test_repo) | 54 | Ok(test_repo) |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | fn prep_git_repo_minus_1_commit() -> Result<GitTestRepo> { | 57 | fn prep_git_repo_minus_1_commit() -> Result<GitTestRepo> { |
| 58 | let test_repo = GitTestRepo::without_repo_in_git_config(); | 58 | let test_repo = GitTestRepo::without_repo_in_git_config(); |
| 59 | let mut config = test_repo | 59 | set_git_nostr_login_config(&test_repo)?; |
| 60 | .git_repo | ||
| 61 | .config() | ||
| 62 | .context("cannot open git config")?; | ||
| 63 | config.set_str("nostr.nsec", TEST_KEY_1_NSEC)?; | ||
| 64 | config.set_str("nostr.npub", TEST_KEY_1_NPUB)?; | ||
| 65 | test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; | 60 | test_repo.add_remote(NOSTR_REMOTE_NAME, &get_nostr_remote_url()?)?; |
| 66 | test_repo.populate_minus_1()?; | 61 | test_repo.populate_minus_1()?; |
| 67 | Ok(test_repo) | 62 | Ok(test_repo) |