aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/common_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-03-01 19:16:31 +0100
committerGitHub <noreply@github.com>2018-03-01 19:16:31 +0100
commit43fe6601682d13c5b05a1fc0850e5f294e636486 (patch)
tree8da577bcc34706b287cf5932ad14b56b53d5ede2 /plumbing/transport/common_test.go
parentd8d17e72525d359044192b998b11926a4eecc2c4 (diff)
parent7fd7090a73f623c74c9f26fe2fcfc8ef86131fe1 (diff)
downloadgo-git-43fe6601682d13c5b05a1fc0850e5f294e636486.tar.gz
Merge pull request #762 from zkry/escape-basic-auth-user-pswd
plubming: transport, Escape the user and pswd for endpoint. Fixes #723
Diffstat (limited to 'plumbing/transport/common_test.go')
-rw-r--r--plumbing/transport/common_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/plumbing/transport/common_test.go b/plumbing/transport/common_test.go
index 4203ce9..17f62a6 100644
--- a/plumbing/transport/common_test.go
+++ b/plumbing/transport/common_test.go
@@ -1,6 +1,7 @@
package transport
import (
+ "net/url"
"testing"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
@@ -153,6 +154,15 @@ func (s *SuiteCommon) TestNewEndpointFileURL(c *C) {
c.Assert(e.String(), Equals, "file:///foo.git")
}
+func (s *SuiteCommon) TestValidEndpoint(c *C) {
+ e, err := NewEndpoint("http://github.com/user/repository.git")
+ e.User = "person@mail.com"
+ e.Password = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
+ url, err := url.Parse(e.String())
+ c.Assert(err, IsNil)
+ c.Assert(url, NotNil)
+}
+
func (s *SuiteCommon) TestNewEndpointInvalidURL(c *C) {
e, err := NewEndpoint("http://\\")
c.Assert(err, NotNil)