Documentation
¶
Index ¶
- type Flow
- type FlowMock
- func (mock *FlowMock) ListSubscribedJobs(ctx context.Context, triggerName string) ([]store.Job, error)
- func (mock *FlowMock) ListSubscribedJobsCalls() []struct{ ... }
- func (mock *FlowMock) ListTrackers(contextMoqParam context.Context) ([]store.Tracker, error)
- func (mock *FlowMock) ListTrackersCalls() []struct{ ... }
- func (mock *FlowMock) ListTriggers(contextMoqParam context.Context) ([]store.Trigger, error)
- func (mock *FlowMock) ListTriggersCalls() []struct{ ... }
- type GetRequest
- type Subscriptions
- type SubscriptionsMock
- func (mock *SubscriptionsMock) Create(ctx context.Context, sub store.Subscription) (string, error)
- func (mock *SubscriptionsMock) CreateCalls() []struct{ ... }
- func (mock *SubscriptionsMock) Delete(ctx context.Context, subID string) error
- func (mock *SubscriptionsMock) DeleteCalls() []struct{ ... }
- func (mock *SubscriptionsMock) Get(ctx context.Context, subID string) (store.Subscription, error)
- func (mock *SubscriptionsMock) GetCalls() []struct{ ... }
- func (mock *SubscriptionsMock) List(ctx context.Context, trackerID string) ([]store.Subscription, error)
- func (mock *SubscriptionsMock) ListCalls() []struct{ ... }
- func (mock *SubscriptionsMock) Update(ctx context.Context, sub store.Subscription) error
- func (mock *SubscriptionsMock) UpdateCalls() []struct{ ... }
- type Tickets
- type TicketsMock
- func (mock *TicketsMock) Create(ctx context.Context, ticket store.Ticket) (string, error)
- func (mock *TicketsMock) CreateCalls() []struct{ ... }
- func (mock *TicketsMock) Get(ctx context.Context, req GetRequest) (store.Ticket, error)
- func (mock *TicketsMock) GetCalls() []struct{ ... }
- func (mock *TicketsMock) Update(ctx context.Context, ticket store.Ticket) error
- func (mock *TicketsMock) UpdateCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flow ¶
type Flow interface {
ListSubscribedJobs(ctx context.Context, triggerName string) ([]store.Job, error)
ListTrackers(ctx context.Context) ([]store.Tracker, error)
ListTriggers(ctx context.Context) ([]store.Trigger, error)
}
Flow defines methods to access the flow configuration.
type FlowMock ¶
type FlowMock struct {
// ListSubscribedJobsFunc mocks the ListSubscribedJobs method.
ListSubscribedJobsFunc func(ctx context.Context, triggerName string) ([]store.Job, error)
// ListTrackersFunc mocks the ListTrackers method.
ListTrackersFunc func(contextMoqParam context.Context) ([]store.Tracker, error)
// ListTriggersFunc mocks the ListTriggers method.
ListTriggersFunc func(contextMoqParam context.Context) ([]store.Trigger, error)
// contains filtered or unexported fields
}
FlowMock is a mock implementation of Flow.
func TestSomethingThatUsesFlow(t *testing.T) {
// make and configure a mocked Flow
mockedFlow := &FlowMock{
ListSubscribedJobsFunc: func(ctx context.Context, triggerName string) ([]store.Job, error) {
panic("mock out the ListSubscribedJobs method")
},
ListTrackersFunc: func(contextMoqParam context.Context) ([]store.Tracker, error) {
panic("mock out the ListTrackers method")
},
ListTriggersFunc: func(contextMoqParam context.Context) ([]store.Trigger, error) {
panic("mock out the ListTriggers method")
},
}
// use mockedFlow in code that requires Flow
// and then make assertions.
}
func (*FlowMock) ListSubscribedJobs ¶
func (mock *FlowMock) ListSubscribedJobs(ctx context.Context, triggerName string) ([]store.Job, error)
ListSubscribedJobs calls ListSubscribedJobsFunc.
func (*FlowMock) ListSubscribedJobsCalls ¶
ListSubscribedJobsCalls gets all the calls that were made to ListSubscribedJobs. Check the length with:
len(mockedFlow.ListSubscribedJobsCalls())
func (*FlowMock) ListTrackers ¶
ListTrackers calls ListTrackersFunc.
func (*FlowMock) ListTrackersCalls ¶
ListTrackersCalls gets all the calls that were made to ListTrackers. Check the length with:
len(mockedFlow.ListTrackersCalls())
func (*FlowMock) ListTriggers ¶
ListTriggers calls ListTriggersFunc.
func (*FlowMock) ListTriggersCalls ¶
ListTriggersCalls gets all the calls that were made to ListTriggers. Check the length with:
len(mockedFlow.ListTriggersCalls())
type GetRequest ¶
type GetRequest struct {
Locator store.Locator `json:"locator"`
TicketID string `json:"ticket_id"`
}
GetRequest describes parameters to get a single ticket.
type Subscriptions ¶
type Subscriptions interface {
Create(ctx context.Context, sub store.Subscription) (subID string, err error)
Get(ctx context.Context, subID string) (store.Subscription, error)
Delete(ctx context.Context, subID string) error
Update(ctx context.Context, sub store.Subscription) error
// List returns all subscriptions if trackerID = ""
List(ctx context.Context, trackerID string) ([]store.Subscription, error)
}
Subscriptions defines methods to store and load information about subscriptions.
type SubscriptionsMock ¶
type SubscriptionsMock struct {
// CreateFunc mocks the Create method.
CreateFunc func(ctx context.Context, sub store.Subscription) (string, error)
// DeleteFunc mocks the Delete method.
DeleteFunc func(ctx context.Context, subID string) error
// GetFunc mocks the Get method.
GetFunc func(ctx context.Context, subID string) (store.Subscription, error)
// ListFunc mocks the List method.
ListFunc func(ctx context.Context, trackerID string) ([]store.Subscription, error)
// UpdateFunc mocks the Update method.
UpdateFunc func(ctx context.Context, sub store.Subscription) error
// contains filtered or unexported fields
}
SubscriptionsMock is a mock implementation of Subscriptions.
func TestSomethingThatUsesSubscriptions(t *testing.T) {
// make and configure a mocked Subscriptions
mockedSubscriptions := &SubscriptionsMock{
CreateFunc: func(ctx context.Context, sub store.Subscription) (string, error) {
panic("mock out the Create method")
},
DeleteFunc: func(ctx context.Context, subID string) error {
panic("mock out the Delete method")
},
GetFunc: func(ctx context.Context, subID string) (store.Subscription, error) {
panic("mock out the Get method")
},
ListFunc: func(ctx context.Context, trackerID string) ([]store.Subscription, error) {
panic("mock out the List method")
},
UpdateFunc: func(ctx context.Context, sub store.Subscription) error {
panic("mock out the Update method")
},
}
// use mockedSubscriptions in code that requires Subscriptions
// and then make assertions.
}
func (*SubscriptionsMock) Create ¶
func (mock *SubscriptionsMock) Create(ctx context.Context, sub store.Subscription) (string, error)
Create calls CreateFunc.
func (*SubscriptionsMock) CreateCalls ¶
func (mock *SubscriptionsMock) CreateCalls() []struct { Ctx context.Context Sub store.Subscription }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedSubscriptions.CreateCalls())
func (*SubscriptionsMock) Delete ¶
func (mock *SubscriptionsMock) Delete(ctx context.Context, subID string) error
Delete calls DeleteFunc.
func (*SubscriptionsMock) DeleteCalls ¶
func (mock *SubscriptionsMock) DeleteCalls() []struct { Ctx context.Context SubID string }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedSubscriptions.DeleteCalls())
func (*SubscriptionsMock) Get ¶
func (mock *SubscriptionsMock) Get(ctx context.Context, subID string) (store.Subscription, error)
Get calls GetFunc.
func (*SubscriptionsMock) GetCalls ¶
func (mock *SubscriptionsMock) GetCalls() []struct { Ctx context.Context SubID string }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedSubscriptions.GetCalls())
func (*SubscriptionsMock) List ¶
func (mock *SubscriptionsMock) List(ctx context.Context, trackerID string) ([]store.Subscription, error)
List calls ListFunc.
func (*SubscriptionsMock) ListCalls ¶
func (mock *SubscriptionsMock) ListCalls() []struct { Ctx context.Context TrackerID string }
ListCalls gets all the calls that were made to List. Check the length with:
len(mockedSubscriptions.ListCalls())
func (*SubscriptionsMock) Update ¶
func (mock *SubscriptionsMock) Update(ctx context.Context, sub store.Subscription) error
Update calls UpdateFunc.
func (*SubscriptionsMock) UpdateCalls ¶
func (mock *SubscriptionsMock) UpdateCalls() []struct { Ctx context.Context Sub store.Subscription }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedSubscriptions.UpdateCalls())
type Tickets ¶
type Tickets interface {
Create(ctx context.Context, ticket store.Ticket) (ticketID string, err error)
Update(ctx context.Context, ticket store.Ticket) error
Get(ctx context.Context, req GetRequest) (store.Ticket, error)
}
Tickets describes methods each storage should implement.
type TicketsMock ¶
type TicketsMock struct {
// CreateFunc mocks the Create method.
CreateFunc func(ctx context.Context, ticket store.Ticket) (string, error)
// GetFunc mocks the Get method.
GetFunc func(ctx context.Context, req GetRequest) (store.Ticket, error)
// UpdateFunc mocks the Update method.
UpdateFunc func(ctx context.Context, ticket store.Ticket) error
// contains filtered or unexported fields
}
TicketsMock is a mock implementation of Tickets.
func TestSomethingThatUsesTickets(t *testing.T) {
// make and configure a mocked Tickets
mockedTickets := &TicketsMock{
CreateFunc: func(ctx context.Context, ticket store.Ticket) (string, error) {
panic("mock out the Create method")
},
GetFunc: func(ctx context.Context, req GetRequest) (store.Ticket, error) {
panic("mock out the Get method")
},
UpdateFunc: func(ctx context.Context, ticket store.Ticket) error {
panic("mock out the Update method")
},
}
// use mockedTickets in code that requires Tickets
// and then make assertions.
}
func (*TicketsMock) CreateCalls ¶
func (mock *TicketsMock) CreateCalls() []struct { Ctx context.Context Ticket store.Ticket }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedTickets.CreateCalls())
func (*TicketsMock) Get ¶
func (mock *TicketsMock) Get(ctx context.Context, req GetRequest) (store.Ticket, error)
Get calls GetFunc.
func (*TicketsMock) GetCalls ¶
func (mock *TicketsMock) GetCalls() []struct { Ctx context.Context Req GetRequest }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedTickets.GetCalls())
func (*TicketsMock) UpdateCalls ¶
func (mock *TicketsMock) UpdateCalls() []struct { Ctx context.Context Ticket store.Ticket }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedTickets.UpdateCalls())