File: uploader_test.go

package info (click to toggle)
git-lfs 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,808 kB
  • sloc: sh: 21,256; makefile: 507; ruby: 417
file content (31 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download | duplicates (4)
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
30
31
package commands

import (
	"testing"

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

type LockingSupportTestCase struct {
	Given           string
	ExpectedToMatch bool
}

func (l *LockingSupportTestCase) Assert(t *testing.T) {
	assert.Equal(t, l.ExpectedToMatch, supportsLockingAPI(l.Given))
}

func TestSupportedLockingHosts(t *testing.T) {
	for desc, c := range map[string]*LockingSupportTestCase{
		"https with path prefix":        {"https://github.com/ttaylorr/dotfiles.git/info/lfs", true},
		"https with root":               {"https://github.com/ttaylorr/dotfiles", true},
		"http with path prefix":         {"http://github.com/ttaylorr/dotfiles.git/info/lfs", false},
		"http with root":                {"http://github.com/ttaylorr/dotfiles", false},
		"ssh with path prefix":          {"ssh://github.com/ttaylorr/dotfiles.git/info/lfs", true},
		"ssh with root":                 {"ssh://github.com/ttaylorr/dotfiles", true},
		"ssh with user and path prefix": {"ssh://git@github.com/ttaylorr/dotfiles.git/info/lfs", true},
		"ssh with user and root":        {"ssh://git@github.com/ttaylorr/dotfiles", true},
	} {
		t.Run(desc, c.Assert)
	}
}