teststructs

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	State_name = map[int32]string{
		0: "STATE_UNSPECIFIED",
		1: "STATE_PENDING",
		2: "STATE_ACTIVE",
		3: "STATE_TERMINATED",
	}
	State_value = map[string]int32{
		"STATE_UNSPECIFIED": 0,
		"STATE_PENDING":     1,
		"STATE_ACTIVE":      2,
		"STATE_TERMINATED":  3,
	}
)

Enum value maps for State.

View Source
var File_pkg_genericcli_printers_proto_test_test_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Foo

type Foo struct {
	Text     string                `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	State    State                 `protobuf:"varint,2,opt,name=state,proto3,enum=printers_test.State" json:"state,omitempty"`
	ListFoos []*NestedFoo          `protobuf:"bytes,3,rep,name=list_foos,json=listFoos,proto3" json:"list_foos,omitempty"`
	MapFoos  map[string]*NestedFoo `` /* 156-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Foo) Descriptor deprecated

func (*Foo) Descriptor() ([]byte, []int)

Deprecated: Use Foo.ProtoReflect.Descriptor instead.

func (*Foo) GetListFoos

func (x *Foo) GetListFoos() []*NestedFoo

func (*Foo) GetMapFoos

func (x *Foo) GetMapFoos() map[string]*NestedFoo

func (*Foo) GetState

func (x *Foo) GetState() State

func (*Foo) GetText

func (x *Foo) GetText() string

func (*Foo) ProtoMessage

func (*Foo) ProtoMessage()

func (*Foo) ProtoReflect

func (x *Foo) ProtoReflect() protoreflect.Message

func (*Foo) Reset

func (x *Foo) Reset()

func (*Foo) String

func (x *Foo) String() string

type MockTestClient

type MockTestClient struct {
	mock.Mock
}

MockTestClient is an autogenerated mock type for the TestClient type

func NewMockTestClient

func NewMockTestClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTestClient

NewMockTestClient creates a new instance of MockTestClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockTestClient) Convert

func (_mock *MockTestClient) Convert(r *TestResponse) ([]string, *TestCreate, *TestUpdate, error)

Convert provides a mock function for the type MockTestClient

func (*MockTestClient) Create

func (_mock *MockTestClient) Create(rq *TestCreate) (*TestResponse, error)

Create provides a mock function for the type MockTestClient

func (*MockTestClient) Delete

func (_mock *MockTestClient) Delete(id string) (*TestResponse, error)

Delete provides a mock function for the type MockTestClient

func (*MockTestClient) EXPECT

func (*MockTestClient) Get

func (_mock *MockTestClient) Get(id string) (*TestResponse, error)

Get provides a mock function for the type MockTestClient

func (*MockTestClient) List

func (_mock *MockTestClient) List() ([]*TestResponse, error)

List provides a mock function for the type MockTestClient

func (*MockTestClient) Update

func (_mock *MockTestClient) Update(rq *TestUpdate) (*TestResponse, error)

Update provides a mock function for the type MockTestClient

type MockTestClient_Convert_Call

type MockTestClient_Convert_Call struct {
	*mock.Call
}

MockTestClient_Convert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Convert'

func (*MockTestClient_Convert_Call) Return

func (_c *MockTestClient_Convert_Call) Return(strings []string, testCreate *TestCreate, testUpdate *TestUpdate, err error) *MockTestClient_Convert_Call

func (*MockTestClient_Convert_Call) Run

func (*MockTestClient_Convert_Call) RunAndReturn

type MockTestClient_Create_Call

type MockTestClient_Create_Call struct {
	*mock.Call
}

MockTestClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'

func (*MockTestClient_Create_Call) Return

func (*MockTestClient_Create_Call) Run

func (*MockTestClient_Create_Call) RunAndReturn

type MockTestClient_Delete_Call

type MockTestClient_Delete_Call struct {
	*mock.Call
}

MockTestClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'

func (*MockTestClient_Delete_Call) Return

func (*MockTestClient_Delete_Call) Run

func (*MockTestClient_Delete_Call) RunAndReturn

type MockTestClient_Expecter

type MockTestClient_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockTestClient_Expecter) Convert

Convert is a helper method to define mock.On call

  • r *TestResponse

func (*MockTestClient_Expecter) Create

Create is a helper method to define mock.On call

  • rq *TestCreate

func (*MockTestClient_Expecter) Delete

Delete is a helper method to define mock.On call

  • id string

func (*MockTestClient_Expecter) Get

Get is a helper method to define mock.On call

  • id string

func (*MockTestClient_Expecter) List

List is a helper method to define mock.On call

func (*MockTestClient_Expecter) Update

Update is a helper method to define mock.On call

  • rq *TestUpdate

type MockTestClient_Get_Call

type MockTestClient_Get_Call struct {
	*mock.Call
}

MockTestClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockTestClient_Get_Call) Return

func (_c *MockTestClient_Get_Call) Return(testResponse *TestResponse, err error) *MockTestClient_Get_Call

func (*MockTestClient_Get_Call) Run

func (*MockTestClient_Get_Call) RunAndReturn

func (_c *MockTestClient_Get_Call) RunAndReturn(run func(id string) (*TestResponse, error)) *MockTestClient_Get_Call

type MockTestClient_List_Call

type MockTestClient_List_Call struct {
	*mock.Call
}

MockTestClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'

func (*MockTestClient_List_Call) Return

func (_c *MockTestClient_List_Call) Return(testResponses []*TestResponse, err error) *MockTestClient_List_Call

func (*MockTestClient_List_Call) Run

func (*MockTestClient_List_Call) RunAndReturn

func (_c *MockTestClient_List_Call) RunAndReturn(run func() ([]*TestResponse, error)) *MockTestClient_List_Call

type MockTestClient_Update_Call

type MockTestClient_Update_Call struct {
	*mock.Call
}

MockTestClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'

func (*MockTestClient_Update_Call) Return

func (*MockTestClient_Update_Call) Run

func (*MockTestClient_Update_Call) RunAndReturn

type NestedFoo

type NestedFoo struct {
	Text []string `protobuf:"bytes,1,rep,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

func (*NestedFoo) Descriptor deprecated

func (*NestedFoo) Descriptor() ([]byte, []int)

Deprecated: Use NestedFoo.ProtoReflect.Descriptor instead.

func (*NestedFoo) GetText

func (x *NestedFoo) GetText() []string

func (*NestedFoo) ProtoMessage

func (*NestedFoo) ProtoMessage()

func (*NestedFoo) ProtoReflect

func (x *NestedFoo) ProtoReflect() protoreflect.Message

func (*NestedFoo) Reset

func (x *NestedFoo) Reset()

func (*NestedFoo) String

func (x *NestedFoo) String() string

type ProtoTestCRUD

type ProtoTestCRUD struct {
	Foo *Foo
}

ProtoTestCRUD can be used for tests using MultiArgGenericCLI.

func (*ProtoTestCRUD) Convert

func (m *ProtoTestCRUD) Convert(r *Foo) ([]string, *Foo, *Foo, error)

func (*ProtoTestCRUD) Create

func (m *ProtoTestCRUD) Create(rq *Foo) (*Foo, error)

func (*ProtoTestCRUD) Delete

func (m *ProtoTestCRUD) Delete(ids ...string) (*Foo, error)

func (*ProtoTestCRUD) Get

func (m *ProtoTestCRUD) Get(ids ...string) (*Foo, error)

func (*ProtoTestCRUD) List

func (m *ProtoTestCRUD) List() ([]*Foo, error)

func (*ProtoTestCRUD) Update

func (m *ProtoTestCRUD) Update(rq *Foo) (*Foo, error)

type State

type State int32
const (
	State_STATE_UNSPECIFIED State = 0
	State_STATE_PENDING     State = 1
	State_STATE_ACTIVE      State = 2
	State_STATE_TERMINATED  State = 3
)

func (State) Descriptor

func (State) Descriptor() protoreflect.EnumDescriptor

func (State) Enum

func (x State) Enum() *State

func (State) EnumDescriptor deprecated

func (State) EnumDescriptor() ([]byte, []int)

Deprecated: Use State.Descriptor instead.

func (State) Number

func (x State) Number() protoreflect.EnumNumber

func (State) String

func (x State) String() string

func (State) Type

func (State) Type() protoreflect.EnumType

type TestCRUD

type TestCRUD struct {
	// contains filtered or unexported fields
}

func NewTestCRUD

func NewTestCRUD(client TestClient) *TestCRUD

func (TestCRUD) Convert

func (t TestCRUD) Convert(r *TestResponse) ([]string, *TestCreate, *TestUpdate, error)

func (TestCRUD) Create

func (t TestCRUD) Create(rq *TestCreate) (*TestResponse, error)

func (TestCRUD) Delete

func (t TestCRUD) Delete(ids ...string) (*TestResponse, error)

func (TestCRUD) Get

func (t TestCRUD) Get(ids ...string) (*TestResponse, error)

func (TestCRUD) List

func (t TestCRUD) List() ([]*TestResponse, error)

func (TestCRUD) Update

func (t TestCRUD) Update(rq *TestUpdate) (*TestResponse, error)

type TestClient

type TestClient interface {
	Get(id string) (*TestResponse, error)
	List() ([]*TestResponse, error)
	Create(rq *TestCreate) (*TestResponse, error)
	Update(rq *TestUpdate) (*TestResponse, error)
	Delete(id string) (*TestResponse, error)
	Convert(r *TestResponse) ([]string, *TestCreate, *TestUpdate, error)
}

type TestCreate

type TestCreate struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type TestResponse

type TestResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type TestUpdate

type TestUpdate struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL