mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-02 22:56:30 +00:00
29 lines
544 B
Go
29 lines
544 B
Go
|
package notify
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/drone/drone/shared/model"
|
||
|
)
|
||
|
|
||
|
func Test_getBuildUrl(t *testing.T) {
|
||
|
c := &model.Request{
|
||
|
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/example/abc"
|
||
|
output := getBuildUrl(c)
|
||
|
|
||
|
if output != expected {
|
||
|
t.Errorf("Failed to build url. Expected: %s, got %s", expected, output)
|
||
|
}
|
||
|
}
|