test: Add TestValidateRemoteURL for ValidateRemoteURL

Golang 1.8 has new implement for `url.Parse`, which may break `ValidateRemoteUrl`.

ValidateRemoteURL("git@github.com:git-lfs/git-lfs")) will return an error
like: "first path segment in URL cannot contain colon".

Signed-off-by: Jiang Xin <xin.jiang@huawei.com>
This commit is contained in:
Jiang Xin 2017-05-04 06:59:28 +08:00
parent 52ab48dda6
commit 827d7a1f78

@ -531,3 +531,14 @@ func TestGetFilesChanges(t *testing.T) {
assert.Equal(t, expected1to2, changes)
}
func TestValidateRemoteURL(t *testing.T) {
assert.Nil(t, ValidateRemoteURL("https://github.com/git-lfs/git-lfs"))
assert.Nil(t, ValidateRemoteURL("http://github.com/git-lfs/git-lfs"))
assert.Nil(t, ValidateRemoteURL("git://github.com/git-lfs/git-lfs"))
assert.Nil(t, ValidateRemoteURL("ssh://git@github.com/git-lfs/git-lfs"))
assert.Nil(t, ValidateRemoteURL("ssh://git@github.com:22/git-lfs/git-lfs"))
assert.Nil(t, ValidateRemoteURL("git@github.com:git-lfs/git-lfs"))
assert.Nil(t, ValidateRemoteURL("git@server:/absolute/path.git"))
assert.NotNil(t, ValidateRemoteURL("ftp://git@github.com/git-lfs/git-lfs"))
}