Skip to content

Commit c4b334d

Browse files
committed
add tests
1 parent 5e64929 commit c4b334d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

remote_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ func (s *RemoteSuite) TestFetchInvalidSchemaEndpoint(c *C) {
4646
c.Assert(err, ErrorMatches, ".*unsupported scheme.*")
4747
}
4848

49+
func (s *RemoteSuite) TestFetchOverriddenEndpoint(c *C) {
50+
r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"http://perfectly-valid-url.example.com"}})
51+
err := r.Fetch(&FetchOptions{RemoteURL: "http://\\"})
52+
c.Assert(err, ErrorMatches, ".*invalid character.*")
53+
}
54+
4955
func (s *RemoteSuite) TestFetchInvalidFetchOptions(c *C) {
5056
r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"qux://foo"}})
5157
invalid := config.RefSpec("^*$ñ")
@@ -903,6 +909,12 @@ func (s *RemoteSuite) TestPushNonExistentEndpoint(c *C) {
903909
c.Assert(err, NotNil)
904910
}
905911

912+
func (s *RemoteSuite) TestPushOverriddenEndpoint(c *C) {
913+
r := NewRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"http://perfectly-valid-url.example.com"}})
914+
err := r.Push(&PushOptions{RemoteURL: "http://\\"})
915+
c.Assert(err, ErrorMatches, ".*invalid character.*")
916+
}
917+
906918
func (s *RemoteSuite) TestPushInvalidSchemaEndpoint(c *C) {
907919
r := NewRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"qux://foo"}})
908920
err := r.Push(&PushOptions{})

0 commit comments

Comments
 (0)