harness-drone/plugin/notify/slack_test.go

28 lines
551 B
Go
Raw Normal View History

package notify
import (
"github.com/drone/drone/shared/model"
"testing"
)
func Test_getBuildUrl(t *testing.T) {
c := &Context{
Host: "http://examplehost.com",
Repo: &model.Repo{
2014-06-12 21:13:03 +00:00
Host: "examplegit.com",
Owner: "owner",
Name: "repo",
},
Commit: &model.Commit{
2014-06-12 21:13:03 +00:00
Sha: "abc",
Branch: "example",
},
}
2014-06-12 21:13:03 +00:00
expected := "http://examplehost.com/examplegit.com/owner/repo/branch/example/commit/abc"
output := getBuildUrl(c)
if output != expected {
t.Errorf("Failed to build url. Expected: %s, got %s", expected, output)
}
}