github.com/cozy/cozy-stack@v0.0.0-20240327093429-939e4a21320e/model/cloudery/service_mock.go (about)

     1  package cloudery
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/cozy/cozy-stack/model/instance"
     7  	"github.com/stretchr/testify/mock"
     8  )
     9  
    10  // Mock impelementation of [Service].
    11  type Mock struct {
    12  	mock.Mock
    13  }
    14  
    15  // NewMock instantiates a new [Mock].
    16  func NewMock(t *testing.T) *Mock {
    17  	m := new(Mock)
    18  	m.Test(t)
    19  	t.Cleanup(func() { m.AssertExpectations(t) })
    20  
    21  	return m
    22  }
    23  
    24  // SaveInstance mock method.
    25  func (m *Mock) SaveInstance(inst *instance.Instance, cmd *SaveCmd) error {
    26  	return m.Called(inst, cmd).Error(0)
    27  }
    28  
    29  func (m *Mock) HasBlockingSubscription(inst *instance.Instance) (bool, error) {
    30  	args := m.Called(inst)
    31  
    32  	return args.Bool(0), args.Error(1)
    33  }