This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 11package transport
22
33import (
4+ "fmt"
45 "net/url"
56 "testing"
67
@@ -155,12 +156,21 @@ func (s *SuiteCommon) TestNewEndpointFileURL(c *C) {
155156}
156157
157158func (s * SuiteCommon ) TestValidEndpoint (c * C ) {
158- e , err := NewEndpoint ("http://github.com/user/repository.git" )
159- e .User = "person@mail.com"
160- e .Password = " !\" #$%&'()*+,-./:;<=>?@[\\ ]^_`{|}~"
161- url , err := url .Parse (e .String ())
159+ user := "person@mail.com"
160+ pass := " !\" #$%&'()*+,-./:;<=>?@[\\ ]^_`{|}~"
161+ e , err := NewEndpoint (fmt .Sprintf (
162+ "http://%s:%s@github.com/user/repository.git" ,
163+ url .PathEscape (user ),
164+ url .PathEscape (pass ),
165+ ))
162166 c .Assert (err , IsNil )
163- c .Assert (url , NotNil )
167+ c .Assert (e , NotNil )
168+ c .Assert (e .User , Equals , user )
169+ c .Assert (e .Password , Equals , pass )
170+ c .Assert (e .Host , Equals , "github.com" )
171+ c .Assert (e .Path , Equals , "/user/repository.git" )
172+
173+ c .Assert (e .String (), Equals , "http://person@mail.com:%20%21%22%23$%25&%27%28%29%2A+%2C-.%2F:%3B%3C=%3E%3F@%5B%5C%5D%5E_%60%7B%7C%7D~@github.com/user/repository.git" )
164174}
165175
166176func (s * SuiteCommon ) TestNewEndpointInvalidURL (c * C ) {
You can’t perform that action at this time.
0 commit comments