github.com/git-lfs/git-lfs@v2.5.2+incompatible/commands/uploader_test.go (about)

     1  package commands
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  type LockingSupportTestCase struct {
    10  	Given           string
    11  	ExpectedToMatch bool
    12  }
    13  
    14  func (l *LockingSupportTestCase) Assert(t *testing.T) {
    15  	assert.Equal(t, l.ExpectedToMatch, supportsLockingAPI(l.Given))
    16  }
    17  
    18  func TestSupportedLockingHosts(t *testing.T) {
    19  	for desc, c := range map[string]*LockingSupportTestCase{
    20  		"https with path prefix":        {"https://github.com/ttaylorr/dotfiles.git/info/lfs", true},
    21  		"https with root":               {"https://github.com/ttaylorr/dotfiles", true},
    22  		"http with path prefix":         {"http://github.com/ttaylorr/dotfiles.git/info/lfs", false},
    23  		"http with root":                {"http://github.com/ttaylorr/dotfiles", false},
    24  		"ssh with path prefix":          {"ssh://github.com/ttaylorr/dotfiles.git/info/lfs", true},
    25  		"ssh with root":                 {"ssh://github.com/ttaylorr/dotfiles", true},
    26  		"ssh with user and path prefix": {"ssh://git@github.com/ttaylorr/dotfiles.git/info/lfs", true},
    27  		"ssh with user and root":        {"ssh://git@github.com/ttaylorr/dotfiles", true},
    28  	} {
    29  		t.Run(desc, c.Assert)
    30  	}
    31  }