// Code generated by moq; DO NOT EDIT. // github.com/matryer/moq package ghcs import ( "context" "sync" "github.com/github/ghcs/internal/api" ) // Ensure, that apiClientMock does implement apiClient. // If this is not the case, regenerate this file with moq. var _ apiClient = &apiClientMock{} // apiClientMock is a mock implementation of apiClient. // // func TestSomethingThatUsesapiClient(t *testing.T) { // // // make and configure a mocked apiClient // mockedapiClient := &apiClientMock{ // DeleteCodespaceFunc: func(ctx context.Context, user string, name string) error { // panic("mock out the DeleteCodespace method") // }, // GetUserFunc: func(ctx context.Context) (*api.User, error) { // panic("mock out the GetUser method") // }, // ListCodespacesFunc: func(ctx context.Context, user string) ([]*api.Codespace, error) { // panic("mock out the ListCodespaces method") // }, // } // // // use mockedapiClient in code that requires apiClient // // and then make assertions. // // } type apiClientMock struct { // DeleteCodespaceFunc mocks the DeleteCodespace method. DeleteCodespaceFunc func(ctx context.Context, user string, name string) error // GetUserFunc mocks the GetUser method. GetUserFunc func(ctx context.Context) (*api.User, error) // ListCodespacesFunc mocks the ListCodespaces method. ListCodespacesFunc func(ctx context.Context, user string) ([]*api.Codespace, error) // calls tracks calls to the methods. calls struct { // DeleteCodespace holds details about calls to the DeleteCodespace method. DeleteCodespace []struct { // Ctx is the ctx argument value. Ctx context.Context // User is the user argument value. User string // Name is the name argument value. Name string } // GetUser holds details about calls to the GetUser method. GetUser []struct { // Ctx is the ctx argument value. Ctx context.Context } // ListCodespaces holds details about calls to the ListCodespaces method. ListCodespaces []struct { // Ctx is the ctx argument value. Ctx context.Context // User is the user argument value. User string } } lockDeleteCodespace sync.RWMutex lockGetUser sync.RWMutex lockListCodespaces sync.RWMutex } // DeleteCodespace calls DeleteCodespaceFunc. func (mock *apiClientMock) DeleteCodespace(ctx context.Context, user string, name string) error { if mock.DeleteCodespaceFunc == nil { panic("apiClientMock.DeleteCodespaceFunc: method is nil but apiClient.DeleteCodespace was just called") } callInfo := struct { Ctx context.Context User string Name string }{ Ctx: ctx, User: user, Name: name, } mock.lockDeleteCodespace.Lock() mock.calls.DeleteCodespace = append(mock.calls.DeleteCodespace, callInfo) mock.lockDeleteCodespace.Unlock() return mock.DeleteCodespaceFunc(ctx, user, name) } // DeleteCodespaceCalls gets all the calls that were made to DeleteCodespace. // Check the length with: // len(mockedapiClient.DeleteCodespaceCalls()) func (mock *apiClientMock) DeleteCodespaceCalls() []struct { Ctx context.Context User string Name string } { var calls []struct { Ctx context.Context User string Name string } mock.lockDeleteCodespace.RLock() calls = mock.calls.DeleteCodespace mock.lockDeleteCodespace.RUnlock() return calls } // GetUser calls GetUserFunc. func (mock *apiClientMock) GetUser(ctx context.Context) (*api.User, error) { if mock.GetUserFunc == nil { panic("apiClientMock.GetUserFunc: method is nil but apiClient.GetUser was just called") } callInfo := struct { Ctx context.Context }{ Ctx: ctx, } mock.lockGetUser.Lock() mock.calls.GetUser = append(mock.calls.GetUser, callInfo) mock.lockGetUser.Unlock() return mock.GetUserFunc(ctx) } // GetUserCalls gets all the calls that were made to GetUser. // Check the length with: // len(mockedapiClient.GetUserCalls()) func (mock *apiClientMock) GetUserCalls() []struct { Ctx context.Context } { var calls []struct { Ctx context.Context } mock.lockGetUser.RLock() calls = mock.calls.GetUser mock.lockGetUser.RUnlock() return calls } // ListCodespaces calls ListCodespacesFunc. func (mock *apiClientMock) ListCodespaces(ctx context.Context, user string) ([]*api.Codespace, error) { if mock.ListCodespacesFunc == nil { panic("apiClientMock.ListCodespacesFunc: method is nil but apiClient.ListCodespaces was just called") } callInfo := struct { Ctx context.Context User string }{ Ctx: ctx, User: user, } mock.lockListCodespaces.Lock() mock.calls.ListCodespaces = append(mock.calls.ListCodespaces, callInfo) mock.lockListCodespaces.Unlock() return mock.ListCodespacesFunc(ctx, user) } // ListCodespacesCalls gets all the calls that were made to ListCodespaces. // Check the length with: // len(mockedapiClient.ListCodespacesCalls()) func (mock *apiClientMock) ListCodespacesCalls() []struct { Ctx context.Context User string } { var calls []struct { Ctx context.Context User string } mock.lockListCodespaces.RLock() calls = mock.calls.ListCodespaces mock.lockListCodespaces.RUnlock() return calls }