Debian Codegraph @

internal/git/authentication_test.go

raw symbols SCIP
1 package git
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/require"
7 )
8
9 func TestAuthProtocol(t *testing.T) {
10 var tests = []struct {
11 input *Remote
12 expected string
13 }{
14 {&Remote{
15 URL: []string{"https://gitlab.com/isacikgoz/dirty-repo.git", ""},
16 }, "https"},
17 {&Remote{
18 URL: []string{"http://gitlab.com/isacikgoz/dirty-repo.git", ""},
19 }, "http"},
20 {&Remote{
21 URL: []string{"[email protected]:isacikgoz/dirty-repo.git", ""},
22 }, "ssh"},
23 }
24 for _, test := range tests {
25 protocol, err := AuthProtocol(test.input)
26 require.NoError(t, err)
27 require.Equal(t, test.expected, protocol)
28 }
29 }