aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorwin <git@nroo.de>2021-09-28 11:10:17 +0200
committerNorwin <git@nroo.de>2021-09-28 11:10:17 +0200
commitc4b334d4679d6fc38e13b2d84af2d832f6c47566 (patch)
treef1ed47d4fce4cea0da7628c167d8ed444d9d40d8
parent5e64929185218f53cb45b0f89fb372e06aa172be (diff)
downloadgo-git-c4b334d4679d6fc38e13b2d84af2d832f6c47566.tar.gz
add tests
-rw-r--r--remote_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go
index 1efc9da..f6601fb 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -46,6 +46,12 @@ func (s *RemoteSuite) TestFetchInvalidSchemaEndpoint(c *C) {
c.Assert(err, ErrorMatches, ".*unsupported scheme.*")
}
+func (s *RemoteSuite) TestFetchOverriddenEndpoint(c *C) {
+ r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"http://perfectly-valid-url.example.com"}})
+ err := r.Fetch(&FetchOptions{RemoteURL: "http://\\"})
+ c.Assert(err, ErrorMatches, ".*invalid character.*")
+}
+
func (s *RemoteSuite) TestFetchInvalidFetchOptions(c *C) {
r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"qux://foo"}})
invalid := config.RefSpec("^*$ñ")
@@ -903,6 +909,12 @@ func (s *RemoteSuite) TestPushNonExistentEndpoint(c *C) {
c.Assert(err, NotNil)
}
+func (s *RemoteSuite) TestPushOverriddenEndpoint(c *C) {
+ r := NewRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"http://perfectly-valid-url.example.com"}})
+ err := r.Push(&PushOptions{RemoteURL: "http://\\"})
+ c.Assert(err, ErrorMatches, ".*invalid character.*")
+}
+
func (s *RemoteSuite) TestPushInvalidSchemaEndpoint(c *C) {
r := NewRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"qux://foo"}})
err := r.Push(&PushOptions{})