diff options
author | jan <git@wiegelmann.net> | 2024-04-13 15:01:34 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-11-03 00:42:08 +0100 |
commit | 46ea695556342708e8d647d3fb07ec9a1518ee20 (patch) | |
tree | 09bb0f5875e19806a96429fd84f3260f8ed695b8 /repository/gogit_test.go | |
parent | 10cdf7860f8bcbf94b73611ebd95b4a1a123bb9f (diff) | |
download | git-bug-devel.tar.gz |
Diffstat (limited to 'repository/gogit_test.go')
-rw-r--r-- | repository/gogit_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/repository/gogit_test.go b/repository/gogit_test.go index 21acd5df..dff94605 100644 --- a/repository/gogit_test.go +++ b/repository/gogit_test.go @@ -2,6 +2,7 @@ package repository import ( "fmt" + "log" "os" "path" "path/filepath" @@ -96,3 +97,48 @@ func TestGoGit_DetectsSubmodules(t *testing.T) { assert.Empty(t, err) assert.Equal(t, expected, result) } + +func TestGoGitRepoSSH(t *testing.T) { + repo := CreateGoGitTestRepo(t, false) + + err := repo.AddRemote("ssh", "ssh://git@github.com:MichaelMure/git-bug.git") + if err != nil { + log.Fatal(err) + } + keys, err := repo.SSHAuth("ssh") + require.NotNil(t, keys) + require.Empty(t, err) + + err = repo.AddRemote("http", "http://github.com/MichaelMure/git-bug.git") + if err != nil { + log.Fatal(err) + } + keys, err = repo.SSHAuth("http") + require.Nil(t, keys) + require.Empty(t, err) + + err = repo.AddRemote("https", "https://github.com/MichaelMure/git-bug.git") + if err != nil { + log.Fatal(err) + } + keys, err = repo.SSHAuth("https") + require.Nil(t, keys) + require.Empty(t, err) + + err = repo.AddRemote("git", "git://github.com/MichaelMure/git-bug.git") + if err != nil { + log.Fatal(err) + } + keys, err = repo.SSHAuth("git") + require.Nil(t, keys) + require.Empty(t, err) + + err = repo.AddRemote("scp-like", "git@github.com:MichaelMure/git-bug.git") + if err != nil { + log.Fatal(err) + } + keys, err = repo.SSHAuth("scp-like") + require.NotNil(t, keys) + require.Empty(t, err) + +} |