You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-scm/scm/driver/gogs/gogs_test.go

36 lines
877 B
Go

// Copyright 2017 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package gogs implements a Gogs client.
package gogs
import "testing"
func TestClient(t *testing.T) {
client, err := New("https://try.gogs.io")
if err != nil {
t.Error(err)
}
if got, want := client.BaseURL.String(), "https://try.gogs.io/"; got != want {
t.Errorf("Want Client URL %q, got %q", want, got)
}
}
func TestClient_Base(t *testing.T) {
client, err := New("https://try.gogs.io/v1")
if err != nil {
t.Error(err)
}
if got, want := client.BaseURL.String(), "https://try.gogs.io/v1/"; got != want {
t.Errorf("Want Client URL %q, got %q", want, got)
}
}
func TestClient_Error(t *testing.T) {
_, err := New("http://a b.com/")
if err == nil {
t.Errorf("Expect error when invalid URL")
}
}