blob: d7cd15333f65d625bcb7a3531e0a1fd2656bb78c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package source
import (
"github.com/stretchr/testify/mock"
"gitlab.com/gitlab-org/gitlab-pages/internal/domain"
)
// MockSource can be used for testing
type MockSource struct {
mock.Mock
}
// GetDomain is a mocked function
func (m *MockSource) GetDomain(name string) (*domain.Domain, error) {
args := m.Called(name)
err := args.Error(1)
d, ok := args.Get(0).(*domain.Domain)
if !ok {
return nil, err
}
return d, err
}
func (m *MockSource) IsReady() bool {
args := m.Called()
return args.Get(0).(bool)
}
// NewMockSource returns a new Source mock for testing
func NewMockSource() *MockSource {
return &MockSource{}
}
|