279 lines
7.2 KiB
Go
279 lines
7.2 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package hass
|
|
|
|
import (
|
|
"encoding/json"
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that PostRequestMock does implement PostRequest.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ PostRequest = &PostRequestMock{}
|
|
|
|
// PostRequestMock is a mock implementation of PostRequest.
|
|
//
|
|
// func TestSomethingThatUsesPostRequest(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked PostRequest
|
|
// mockedPostRequest := &PostRequestMock{
|
|
// RequestBodyFunc: func() json.RawMessage {
|
|
// panic("mock out the RequestBody method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedPostRequest in code that requires PostRequest
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type PostRequestMock struct {
|
|
// RequestBodyFunc mocks the RequestBody method.
|
|
RequestBodyFunc func() json.RawMessage
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// RequestBody holds details about calls to the RequestBody method.
|
|
RequestBody []struct {
|
|
}
|
|
}
|
|
lockRequestBody sync.RWMutex
|
|
}
|
|
|
|
// RequestBody calls RequestBodyFunc.
|
|
func (mock *PostRequestMock) RequestBody() json.RawMessage {
|
|
if mock.RequestBodyFunc == nil {
|
|
panic("PostRequestMock.RequestBodyFunc: method is nil but PostRequest.RequestBody was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockRequestBody.Lock()
|
|
mock.calls.RequestBody = append(mock.calls.RequestBody, callInfo)
|
|
mock.lockRequestBody.Unlock()
|
|
return mock.RequestBodyFunc()
|
|
}
|
|
|
|
// RequestBodyCalls gets all the calls that were made to RequestBody.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedPostRequest.RequestBodyCalls())
|
|
func (mock *PostRequestMock) RequestBodyCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockRequestBody.RLock()
|
|
calls = mock.calls.RequestBody
|
|
mock.lockRequestBody.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Ensure, that RegistryMock does implement Registry.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Registry = &RegistryMock{}
|
|
|
|
// RegistryMock is a mock implementation of Registry.
|
|
//
|
|
// func TestSomethingThatUsesRegistry(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Registry
|
|
// mockedRegistry := &RegistryMock{
|
|
// IsDisabledFunc: func(id string) bool {
|
|
// panic("mock out the IsDisabled method")
|
|
// },
|
|
// IsRegisteredFunc: func(id string) bool {
|
|
// panic("mock out the IsRegistered method")
|
|
// },
|
|
// SetDisabledFunc: func(id string, state bool) error {
|
|
// panic("mock out the SetDisabled method")
|
|
// },
|
|
// SetRegisteredFunc: func(id string, state bool) error {
|
|
// panic("mock out the SetRegistered method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedRegistry in code that requires Registry
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type RegistryMock struct {
|
|
// IsDisabledFunc mocks the IsDisabled method.
|
|
IsDisabledFunc func(id string) bool
|
|
|
|
// IsRegisteredFunc mocks the IsRegistered method.
|
|
IsRegisteredFunc func(id string) bool
|
|
|
|
// SetDisabledFunc mocks the SetDisabled method.
|
|
SetDisabledFunc func(id string, state bool) error
|
|
|
|
// SetRegisteredFunc mocks the SetRegistered method.
|
|
SetRegisteredFunc func(id string, state bool) error
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// IsDisabled holds details about calls to the IsDisabled method.
|
|
IsDisabled []struct {
|
|
// ID is the id argument value.
|
|
ID string
|
|
}
|
|
// IsRegistered holds details about calls to the IsRegistered method.
|
|
IsRegistered []struct {
|
|
// ID is the id argument value.
|
|
ID string
|
|
}
|
|
// SetDisabled holds details about calls to the SetDisabled method.
|
|
SetDisabled []struct {
|
|
// ID is the id argument value.
|
|
ID string
|
|
// State is the state argument value.
|
|
State bool
|
|
}
|
|
// SetRegistered holds details about calls to the SetRegistered method.
|
|
SetRegistered []struct {
|
|
// ID is the id argument value.
|
|
ID string
|
|
// State is the state argument value.
|
|
State bool
|
|
}
|
|
}
|
|
lockIsDisabled sync.RWMutex
|
|
lockIsRegistered sync.RWMutex
|
|
lockSetDisabled sync.RWMutex
|
|
lockSetRegistered sync.RWMutex
|
|
}
|
|
|
|
// IsDisabled calls IsDisabledFunc.
|
|
func (mock *RegistryMock) IsDisabled(id string) bool {
|
|
if mock.IsDisabledFunc == nil {
|
|
panic("RegistryMock.IsDisabledFunc: method is nil but Registry.IsDisabled was just called")
|
|
}
|
|
callInfo := struct {
|
|
ID string
|
|
}{
|
|
ID: id,
|
|
}
|
|
mock.lockIsDisabled.Lock()
|
|
mock.calls.IsDisabled = append(mock.calls.IsDisabled, callInfo)
|
|
mock.lockIsDisabled.Unlock()
|
|
return mock.IsDisabledFunc(id)
|
|
}
|
|
|
|
// IsDisabledCalls gets all the calls that were made to IsDisabled.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedRegistry.IsDisabledCalls())
|
|
func (mock *RegistryMock) IsDisabledCalls() []struct {
|
|
ID string
|
|
} {
|
|
var calls []struct {
|
|
ID string
|
|
}
|
|
mock.lockIsDisabled.RLock()
|
|
calls = mock.calls.IsDisabled
|
|
mock.lockIsDisabled.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// IsRegistered calls IsRegisteredFunc.
|
|
func (mock *RegistryMock) IsRegistered(id string) bool {
|
|
if mock.IsRegisteredFunc == nil {
|
|
panic("RegistryMock.IsRegisteredFunc: method is nil but Registry.IsRegistered was just called")
|
|
}
|
|
callInfo := struct {
|
|
ID string
|
|
}{
|
|
ID: id,
|
|
}
|
|
mock.lockIsRegistered.Lock()
|
|
mock.calls.IsRegistered = append(mock.calls.IsRegistered, callInfo)
|
|
mock.lockIsRegistered.Unlock()
|
|
return mock.IsRegisteredFunc(id)
|
|
}
|
|
|
|
// IsRegisteredCalls gets all the calls that were made to IsRegistered.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedRegistry.IsRegisteredCalls())
|
|
func (mock *RegistryMock) IsRegisteredCalls() []struct {
|
|
ID string
|
|
} {
|
|
var calls []struct {
|
|
ID string
|
|
}
|
|
mock.lockIsRegistered.RLock()
|
|
calls = mock.calls.IsRegistered
|
|
mock.lockIsRegistered.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// SetDisabled calls SetDisabledFunc.
|
|
func (mock *RegistryMock) SetDisabled(id string, state bool) error {
|
|
if mock.SetDisabledFunc == nil {
|
|
panic("RegistryMock.SetDisabledFunc: method is nil but Registry.SetDisabled was just called")
|
|
}
|
|
callInfo := struct {
|
|
ID string
|
|
State bool
|
|
}{
|
|
ID: id,
|
|
State: state,
|
|
}
|
|
mock.lockSetDisabled.Lock()
|
|
mock.calls.SetDisabled = append(mock.calls.SetDisabled, callInfo)
|
|
mock.lockSetDisabled.Unlock()
|
|
return mock.SetDisabledFunc(id, state)
|
|
}
|
|
|
|
// SetDisabledCalls gets all the calls that were made to SetDisabled.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedRegistry.SetDisabledCalls())
|
|
func (mock *RegistryMock) SetDisabledCalls() []struct {
|
|
ID string
|
|
State bool
|
|
} {
|
|
var calls []struct {
|
|
ID string
|
|
State bool
|
|
}
|
|
mock.lockSetDisabled.RLock()
|
|
calls = mock.calls.SetDisabled
|
|
mock.lockSetDisabled.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// SetRegistered calls SetRegisteredFunc.
|
|
func (mock *RegistryMock) SetRegistered(id string, state bool) error {
|
|
if mock.SetRegisteredFunc == nil {
|
|
panic("RegistryMock.SetRegisteredFunc: method is nil but Registry.SetRegistered was just called")
|
|
}
|
|
callInfo := struct {
|
|
ID string
|
|
State bool
|
|
}{
|
|
ID: id,
|
|
State: state,
|
|
}
|
|
mock.lockSetRegistered.Lock()
|
|
mock.calls.SetRegistered = append(mock.calls.SetRegistered, callInfo)
|
|
mock.lockSetRegistered.Unlock()
|
|
return mock.SetRegisteredFunc(id, state)
|
|
}
|
|
|
|
// SetRegisteredCalls gets all the calls that were made to SetRegistered.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedRegistry.SetRegisteredCalls())
|
|
func (mock *RegistryMock) SetRegisteredCalls() []struct {
|
|
ID string
|
|
State bool
|
|
} {
|
|
var calls []struct {
|
|
ID string
|
|
State bool
|
|
}
|
|
mock.lockSetRegistered.RLock()
|
|
calls = mock.calls.SetRegistered
|
|
mock.lockSetRegistered.RUnlock()
|
|
return calls
|
|
}
|