27 lines
551 B
Go
27 lines
551 B
Go
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{
|
|
Host: "examplegit.com",
|
|
Owner: "owner",
|
|
Name: "repo",
|
|
},
|
|
Commit: &model.Commit{
|
|
Sha: "abc",
|
|
Branch: "example",
|
|
},
|
|
}
|
|
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)
|
|
}
|
|
}
|