File: authentication_test.go

package info (click to toggle)
gitbatch 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 644 kB
  • sloc: makefile: 5; sh: 1
file content (29 lines) | stat: -rw-r--r-- 611 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package git

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestAuthProtocol(t *testing.T) {
	var tests = []struct {
		input    *Remote
		expected string
	}{
		{&Remote{
			URL: []string{"https://gitlab.com/isacikgoz/dirty-repo.git", ""},
		}, "https"},
		{&Remote{
			URL: []string{"http://gitlab.com/isacikgoz/dirty-repo.git", ""},
		}, "http"},
		{&Remote{
			URL: []string{"git@gitlab.com:isacikgoz/dirty-repo.git", ""},
		}, "ssh"},
	}
	for _, test := range tests {
		protocol, err := AuthProtocol(test.input)
		require.NoError(t, err)
		require.Equal(t, test.expected, protocol)
	}
}