Welcome to mirror list, hosted at ThFree Co, Russian Federation.

source_mock.go « source « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4d67b0bed27f16c7829e3bb44e84a4a2023d2e0e (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
37
38
39
40
41
42
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)
}

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{}
}