mock_session_registry_test.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. // Code generated by mockery; DO NOT EDIT.
  2. // github.com/vektra/mockery
  3. // template: testify
  4. package foodgroup
  5. import (
  6. "context"
  7. "github.com/mk6i/open-oscar-server/state"
  8. mock "github.com/stretchr/testify/mock"
  9. )
  10. // newMockSessionRegistry creates a new instance of mockSessionRegistry. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
  11. // The first argument is typically a *testing.T value.
  12. func newMockSessionRegistry(t interface {
  13. mock.TestingT
  14. Cleanup(func())
  15. }) *mockSessionRegistry {
  16. mock := &mockSessionRegistry{}
  17. mock.Mock.Test(t)
  18. t.Cleanup(func() { mock.AssertExpectations(t) })
  19. return mock
  20. }
  21. // mockSessionRegistry is an autogenerated mock type for the SessionRegistry type
  22. type mockSessionRegistry struct {
  23. mock.Mock
  24. }
  25. type mockSessionRegistry_Expecter struct {
  26. mock *mock.Mock
  27. }
  28. func (_m *mockSessionRegistry) EXPECT() *mockSessionRegistry_Expecter {
  29. return &mockSessionRegistry_Expecter{mock: &_m.Mock}
  30. }
  31. // AddSession provides a mock function for the type mockSessionRegistry
  32. func (_mock *mockSessionRegistry) AddSession(ctx context.Context, screenName state.DisplayScreenName, doMultiSess bool, cfg ...func(sess *state.Session)) (*state.SessionInstance, error) {
  33. // func(sess *state.Session)
  34. _va := make([]interface{}, len(cfg))
  35. for _i := range cfg {
  36. _va[_i] = cfg[_i]
  37. }
  38. var _ca []interface{}
  39. _ca = append(_ca, ctx, screenName, doMultiSess)
  40. _ca = append(_ca, _va...)
  41. ret := _mock.Called(_ca...)
  42. if len(ret) == 0 {
  43. panic("no return value specified for AddSession")
  44. }
  45. var r0 *state.SessionInstance
  46. var r1 error
  47. if returnFunc, ok := ret.Get(0).(func(context.Context, state.DisplayScreenName, bool, ...func(sess *state.Session)) (*state.SessionInstance, error)); ok {
  48. return returnFunc(ctx, screenName, doMultiSess, cfg...)
  49. }
  50. if returnFunc, ok := ret.Get(0).(func(context.Context, state.DisplayScreenName, bool, ...func(sess *state.Session)) *state.SessionInstance); ok {
  51. r0 = returnFunc(ctx, screenName, doMultiSess, cfg...)
  52. } else {
  53. if ret.Get(0) != nil {
  54. r0 = ret.Get(0).(*state.SessionInstance)
  55. }
  56. }
  57. if returnFunc, ok := ret.Get(1).(func(context.Context, state.DisplayScreenName, bool, ...func(sess *state.Session)) error); ok {
  58. r1 = returnFunc(ctx, screenName, doMultiSess, cfg...)
  59. } else {
  60. r1 = ret.Error(1)
  61. }
  62. return r0, r1
  63. }
  64. // mockSessionRegistry_AddSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddSession'
  65. type mockSessionRegistry_AddSession_Call struct {
  66. *mock.Call
  67. }
  68. // AddSession is a helper method to define mock.On call
  69. // - ctx context.Context
  70. // - screenName state.DisplayScreenName
  71. // - doMultiSess bool
  72. // - cfg ...func(sess *state.Session)
  73. func (_e *mockSessionRegistry_Expecter) AddSession(ctx interface{}, screenName interface{}, doMultiSess interface{}, cfg ...interface{}) *mockSessionRegistry_AddSession_Call {
  74. return &mockSessionRegistry_AddSession_Call{Call: _e.mock.On("AddSession",
  75. append([]interface{}{ctx, screenName, doMultiSess}, cfg...)...)}
  76. }
  77. func (_c *mockSessionRegistry_AddSession_Call) Run(run func(ctx context.Context, screenName state.DisplayScreenName, doMultiSess bool, cfg ...func(sess *state.Session))) *mockSessionRegistry_AddSession_Call {
  78. _c.Call.Run(func(args mock.Arguments) {
  79. var arg0 context.Context
  80. if args[0] != nil {
  81. arg0 = args[0].(context.Context)
  82. }
  83. var arg1 state.DisplayScreenName
  84. if args[1] != nil {
  85. arg1 = args[1].(state.DisplayScreenName)
  86. }
  87. var arg2 bool
  88. if args[2] != nil {
  89. arg2 = args[2].(bool)
  90. }
  91. var arg3 []func(sess *state.Session)
  92. variadicArgs := make([]func(sess *state.Session), len(args)-3)
  93. for i, a := range args[3:] {
  94. if a != nil {
  95. variadicArgs[i] = a.(func(sess *state.Session))
  96. }
  97. }
  98. arg3 = variadicArgs
  99. run(
  100. arg0,
  101. arg1,
  102. arg2,
  103. arg3...,
  104. )
  105. })
  106. return _c
  107. }
  108. func (_c *mockSessionRegistry_AddSession_Call) Return(sessionInstance *state.SessionInstance, err error) *mockSessionRegistry_AddSession_Call {
  109. _c.Call.Return(sessionInstance, err)
  110. return _c
  111. }
  112. func (_c *mockSessionRegistry_AddSession_Call) RunAndReturn(run func(ctx context.Context, screenName state.DisplayScreenName, doMultiSess bool, cfg ...func(sess *state.Session)) (*state.SessionInstance, error)) *mockSessionRegistry_AddSession_Call {
  113. _c.Call.Return(run)
  114. return _c
  115. }
  116. // RemoveSession provides a mock function for the type mockSessionRegistry
  117. func (_mock *mockSessionRegistry) RemoveSession(session *state.Session) {
  118. _mock.Called(session)
  119. return
  120. }
  121. // mockSessionRegistry_RemoveSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveSession'
  122. type mockSessionRegistry_RemoveSession_Call struct {
  123. *mock.Call
  124. }
  125. // RemoveSession is a helper method to define mock.On call
  126. // - session *state.Session
  127. func (_e *mockSessionRegistry_Expecter) RemoveSession(session interface{}) *mockSessionRegistry_RemoveSession_Call {
  128. return &mockSessionRegistry_RemoveSession_Call{Call: _e.mock.On("RemoveSession", session)}
  129. }
  130. func (_c *mockSessionRegistry_RemoveSession_Call) Run(run func(session *state.Session)) *mockSessionRegistry_RemoveSession_Call {
  131. _c.Call.Run(func(args mock.Arguments) {
  132. var arg0 *state.Session
  133. if args[0] != nil {
  134. arg0 = args[0].(*state.Session)
  135. }
  136. run(
  137. arg0,
  138. )
  139. })
  140. return _c
  141. }
  142. func (_c *mockSessionRegistry_RemoveSession_Call) Return() *mockSessionRegistry_RemoveSession_Call {
  143. _c.Call.Return()
  144. return _c
  145. }
  146. func (_c *mockSessionRegistry_RemoveSession_Call) RunAndReturn(run func(session *state.Session)) *mockSessionRegistry_RemoveSession_Call {
  147. _c.Run(run)
  148. return _c
  149. }