forked from adamm/autogits
35 lines
651 B
Go
35 lines
651 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.uber.org/mock/gomock"
|
|
"src.opensuse.org/autogits/common"
|
|
mock_common "src.opensuse.org/autogits/common/mock"
|
|
)
|
|
|
|
func TestWatchObsProject(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
res common.BuildResultList
|
|
}{
|
|
{
|
|
name: "two requests",
|
|
res: common.BuildResultList{
|
|
State: "success",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
ctl := gomock.NewController(t)
|
|
obs := mock_common.NewMockObsStatusFetcherWithState(ctl)
|
|
|
|
obs.EXPECT().BuildStatusWithState("test:foo", "").Return(&test.res, nil)
|
|
|
|
WatchObsProject(obs, "test:foo")
|
|
})
|
|
}
|
|
}
|