2cbf823b10
Signed-off-by: Steven Kriegler <sk.bunsenbrenner@gmail.com>
38 lines
955 B
Go
38 lines
955 B
Go
package gitea
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea-sonarqube-bot/internal/settings"
|
|
|
|
"code.gitea.io/sdk/gitea"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
type SdkMock struct {
|
|
}
|
|
|
|
func (m *SdkMock) CreateIssueComment(owner, repo string, index int64, opt gitea.CreateIssueCommentOption) (*gitea.Comment, *gitea.Response, error) {
|
|
return nil, nil, nil
|
|
}
|
|
func (m *SdkMock) CreateStatus(owner, repo, sha string, opts gitea.CreateStatusOption) (*gitea.Status, *gitea.Response, error) {
|
|
return nil, nil, nil
|
|
}
|
|
func (m *SdkMock) GetPullRequest(owner, repo string, index int64) (*gitea.PullRequest, *gitea.Response, error) {
|
|
return nil, nil, nil
|
|
}
|
|
|
|
func TestNew(t *testing.T) {
|
|
config := &settings.GiteaConfig{
|
|
Url: "http://example.com",
|
|
Token: &settings.Token{
|
|
Value: "test-token",
|
|
},
|
|
}
|
|
|
|
callback := func(url string, options ...gitea.ClientOption) (*SdkMock, error) {
|
|
return &SdkMock{}, nil
|
|
}
|
|
assert.IsType(t, &GiteaSdk{}, New(config, callback), "")
|
|
}
|