|
@@ -19,20 +19,20 @@ type ArticleRepositoryMock struct {
|
|
|
t minimock.Tester
|
|
|
finishOnce sync.Once
|
|
|
|
|
|
- funcGetAllPreview func(ctx context.Context) (aa1 []models.ArticlePreview, err error)
|
|
|
- inspectFuncGetAllPreview func(ctx context.Context)
|
|
|
+ funcGetAllPreview func(ctx context.Context, lang models.Language) (aa1 []models.ArticlePreview, err error)
|
|
|
+ inspectFuncGetAllPreview func(ctx context.Context, lang models.Language)
|
|
|
afterGetAllPreviewCounter uint64
|
|
|
beforeGetAllPreviewCounter uint64
|
|
|
GetAllPreviewMock mArticleRepositoryMockGetAllPreview
|
|
|
|
|
|
- funcGetByURL func(ctx context.Context, url string) (ap1 *models.Article, err error)
|
|
|
- inspectFuncGetByURL func(ctx context.Context, url string)
|
|
|
+ funcGetByURL func(ctx context.Context, url string, lang models.Language) (ap1 *models.Article, err error)
|
|
|
+ inspectFuncGetByURL func(ctx context.Context, url string, lang models.Language)
|
|
|
afterGetByURLCounter uint64
|
|
|
beforeGetByURLCounter uint64
|
|
|
GetByURLMock mArticleRepositoryMockGetByURL
|
|
|
|
|
|
- funcGetPreviewByTagID func(ctx context.Context, tagID uint64) (aa1 []models.ArticlePreview, err error)
|
|
|
- inspectFuncGetPreviewByTagID func(ctx context.Context, tagID uint64)
|
|
|
+ funcGetPreviewByTagID func(ctx context.Context, tagID uint64, lang models.Language) (aa1 []models.ArticlePreview, err error)
|
|
|
+ inspectFuncGetPreviewByTagID func(ctx context.Context, tagID uint64, lang models.Language)
|
|
|
afterGetPreviewByTagIDCounter uint64
|
|
|
beforeGetPreviewByTagIDCounter uint64
|
|
|
GetPreviewByTagIDMock mArticleRepositoryMockGetPreviewByTagID
|
|
@@ -83,12 +83,14 @@ type ArticleRepositoryMockGetAllPreviewExpectation struct {
|
|
|
|
|
|
// ArticleRepositoryMockGetAllPreviewParams contains parameters of the ArticleRepository.GetAllPreview
|
|
|
type ArticleRepositoryMockGetAllPreviewParams struct {
|
|
|
- ctx context.Context
|
|
|
+ ctx context.Context
|
|
|
+ lang models.Language
|
|
|
}
|
|
|
|
|
|
// ArticleRepositoryMockGetAllPreviewParamPtrs contains pointers to parameters of the ArticleRepository.GetAllPreview
|
|
|
type ArticleRepositoryMockGetAllPreviewParamPtrs struct {
|
|
|
- ctx *context.Context
|
|
|
+ ctx *context.Context
|
|
|
+ lang *models.Language
|
|
|
}
|
|
|
|
|
|
// ArticleRepositoryMockGetAllPreviewResults contains results of the ArticleRepository.GetAllPreview
|
|
@@ -108,7 +110,7 @@ func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Optional() *mArticle
|
|
|
}
|
|
|
|
|
|
// Expect sets up expected params for ArticleRepository.GetAllPreview
|
|
|
-func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Expect(ctx context.Context) *mArticleRepositoryMockGetAllPreview {
|
|
|
+func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Expect(ctx context.Context, lang models.Language) *mArticleRepositoryMockGetAllPreview {
|
|
|
if mmGetAllPreview.mock.funcGetAllPreview != nil {
|
|
|
mmGetAllPreview.mock.t.Fatalf("ArticleRepositoryMock.GetAllPreview mock is already set by Set")
|
|
|
}
|
|
@@ -121,7 +123,7 @@ func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Expect(ctx context.C
|
|
|
mmGetAllPreview.mock.t.Fatalf("ArticleRepositoryMock.GetAllPreview mock is already set by ExpectParams functions")
|
|
|
}
|
|
|
|
|
|
- mmGetAllPreview.defaultExpectation.params = &ArticleRepositoryMockGetAllPreviewParams{ctx}
|
|
|
+ mmGetAllPreview.defaultExpectation.params = &ArticleRepositoryMockGetAllPreviewParams{ctx, lang}
|
|
|
for _, e := range mmGetAllPreview.expectations {
|
|
|
if minimock.Equal(e.params, mmGetAllPreview.defaultExpectation.params) {
|
|
|
mmGetAllPreview.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetAllPreview.defaultExpectation.params)
|
|
@@ -153,8 +155,30 @@ func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) ExpectCtxParam1(ctx
|
|
|
return mmGetAllPreview
|
|
|
}
|
|
|
|
|
|
+// ExpectLangParam2 sets up expected param lang for ArticleRepository.GetAllPreview
|
|
|
+func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) ExpectLangParam2(lang models.Language) *mArticleRepositoryMockGetAllPreview {
|
|
|
+ if mmGetAllPreview.mock.funcGetAllPreview != nil {
|
|
|
+ mmGetAllPreview.mock.t.Fatalf("ArticleRepositoryMock.GetAllPreview mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetAllPreview.defaultExpectation == nil {
|
|
|
+ mmGetAllPreview.defaultExpectation = &ArticleRepositoryMockGetAllPreviewExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetAllPreview.defaultExpectation.params != nil {
|
|
|
+ mmGetAllPreview.mock.t.Fatalf("ArticleRepositoryMock.GetAllPreview mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetAllPreview.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmGetAllPreview.defaultExpectation.paramPtrs = &ArticleRepositoryMockGetAllPreviewParamPtrs{}
|
|
|
+ }
|
|
|
+ mmGetAllPreview.defaultExpectation.paramPtrs.lang = &lang
|
|
|
+
|
|
|
+ return mmGetAllPreview
|
|
|
+}
|
|
|
+
|
|
|
// Inspect accepts an inspector function that has same arguments as the ArticleRepository.GetAllPreview
|
|
|
-func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Inspect(f func(ctx context.Context)) *mArticleRepositoryMockGetAllPreview {
|
|
|
+func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Inspect(f func(ctx context.Context, lang models.Language)) *mArticleRepositoryMockGetAllPreview {
|
|
|
if mmGetAllPreview.mock.inspectFuncGetAllPreview != nil {
|
|
|
mmGetAllPreview.mock.t.Fatalf("Inspect function is already set for ArticleRepositoryMock.GetAllPreview")
|
|
|
}
|
|
@@ -178,7 +202,7 @@ func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Return(aa1 []models.
|
|
|
}
|
|
|
|
|
|
// Set uses given function f to mock the ArticleRepository.GetAllPreview method
|
|
|
-func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Set(f func(ctx context.Context) (aa1 []models.ArticlePreview, err error)) *ArticleRepositoryMock {
|
|
|
+func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Set(f func(ctx context.Context, lang models.Language) (aa1 []models.ArticlePreview, err error)) *ArticleRepositoryMock {
|
|
|
if mmGetAllPreview.defaultExpectation != nil {
|
|
|
mmGetAllPreview.mock.t.Fatalf("Default expectation is already set for the ArticleRepository.GetAllPreview method")
|
|
|
}
|
|
@@ -193,14 +217,14 @@ func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) Set(f func(ctx conte
|
|
|
|
|
|
// When sets expectation for the ArticleRepository.GetAllPreview which will trigger the result defined by the following
|
|
|
// Then helper
|
|
|
-func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) When(ctx context.Context) *ArticleRepositoryMockGetAllPreviewExpectation {
|
|
|
+func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) When(ctx context.Context, lang models.Language) *ArticleRepositoryMockGetAllPreviewExpectation {
|
|
|
if mmGetAllPreview.mock.funcGetAllPreview != nil {
|
|
|
mmGetAllPreview.mock.t.Fatalf("ArticleRepositoryMock.GetAllPreview mock is already set by Set")
|
|
|
}
|
|
|
|
|
|
expectation := &ArticleRepositoryMockGetAllPreviewExpectation{
|
|
|
mock: mmGetAllPreview.mock,
|
|
|
- params: &ArticleRepositoryMockGetAllPreviewParams{ctx},
|
|
|
+ params: &ArticleRepositoryMockGetAllPreviewParams{ctx, lang},
|
|
|
}
|
|
|
mmGetAllPreview.expectations = append(mmGetAllPreview.expectations, expectation)
|
|
|
return expectation
|
|
@@ -233,15 +257,15 @@ func (mmGetAllPreview *mArticleRepositoryMockGetAllPreview) invocationsDone() bo
|
|
|
}
|
|
|
|
|
|
// GetAllPreview implements handler.ArticleRepository
|
|
|
-func (mmGetAllPreview *ArticleRepositoryMock) GetAllPreview(ctx context.Context) (aa1 []models.ArticlePreview, err error) {
|
|
|
+func (mmGetAllPreview *ArticleRepositoryMock) GetAllPreview(ctx context.Context, lang models.Language) (aa1 []models.ArticlePreview, err error) {
|
|
|
mm_atomic.AddUint64(&mmGetAllPreview.beforeGetAllPreviewCounter, 1)
|
|
|
defer mm_atomic.AddUint64(&mmGetAllPreview.afterGetAllPreviewCounter, 1)
|
|
|
|
|
|
if mmGetAllPreview.inspectFuncGetAllPreview != nil {
|
|
|
- mmGetAllPreview.inspectFuncGetAllPreview(ctx)
|
|
|
+ mmGetAllPreview.inspectFuncGetAllPreview(ctx, lang)
|
|
|
}
|
|
|
|
|
|
- mm_params := ArticleRepositoryMockGetAllPreviewParams{ctx}
|
|
|
+ mm_params := ArticleRepositoryMockGetAllPreviewParams{ctx, lang}
|
|
|
|
|
|
// Record call args
|
|
|
mmGetAllPreview.GetAllPreviewMock.mutex.Lock()
|
|
@@ -260,7 +284,7 @@ func (mmGetAllPreview *ArticleRepositoryMock) GetAllPreview(ctx context.Context)
|
|
|
mm_want := mmGetAllPreview.GetAllPreviewMock.defaultExpectation.params
|
|
|
mm_want_ptrs := mmGetAllPreview.GetAllPreviewMock.defaultExpectation.paramPtrs
|
|
|
|
|
|
- mm_got := ArticleRepositoryMockGetAllPreviewParams{ctx}
|
|
|
+ mm_got := ArticleRepositoryMockGetAllPreviewParams{ctx, lang}
|
|
|
|
|
|
if mm_want_ptrs != nil {
|
|
|
|
|
@@ -268,6 +292,10 @@ func (mmGetAllPreview *ArticleRepositoryMock) GetAllPreview(ctx context.Context)
|
|
|
mmGetAllPreview.t.Errorf("ArticleRepositoryMock.GetAllPreview got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
|
|
}
|
|
|
|
|
|
+ if mm_want_ptrs.lang != nil && !minimock.Equal(*mm_want_ptrs.lang, mm_got.lang) {
|
|
|
+ mmGetAllPreview.t.Errorf("ArticleRepositoryMock.GetAllPreview got unexpected parameter lang, want: %#v, got: %#v%s\n", *mm_want_ptrs.lang, mm_got.lang, minimock.Diff(*mm_want_ptrs.lang, mm_got.lang))
|
|
|
+ }
|
|
|
+
|
|
|
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
mmGetAllPreview.t.Errorf("ArticleRepositoryMock.GetAllPreview got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
}
|
|
@@ -279,9 +307,9 @@ func (mmGetAllPreview *ArticleRepositoryMock) GetAllPreview(ctx context.Context)
|
|
|
return (*mm_results).aa1, (*mm_results).err
|
|
|
}
|
|
|
if mmGetAllPreview.funcGetAllPreview != nil {
|
|
|
- return mmGetAllPreview.funcGetAllPreview(ctx)
|
|
|
+ return mmGetAllPreview.funcGetAllPreview(ctx, lang)
|
|
|
}
|
|
|
- mmGetAllPreview.t.Fatalf("Unexpected call to ArticleRepositoryMock.GetAllPreview. %v", ctx)
|
|
|
+ mmGetAllPreview.t.Fatalf("Unexpected call to ArticleRepositoryMock.GetAllPreview. %v %v", ctx, lang)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -376,14 +404,16 @@ type ArticleRepositoryMockGetByURLExpectation struct {
|
|
|
|
|
|
// ArticleRepositoryMockGetByURLParams contains parameters of the ArticleRepository.GetByURL
|
|
|
type ArticleRepositoryMockGetByURLParams struct {
|
|
|
- ctx context.Context
|
|
|
- url string
|
|
|
+ ctx context.Context
|
|
|
+ url string
|
|
|
+ lang models.Language
|
|
|
}
|
|
|
|
|
|
// ArticleRepositoryMockGetByURLParamPtrs contains pointers to parameters of the ArticleRepository.GetByURL
|
|
|
type ArticleRepositoryMockGetByURLParamPtrs struct {
|
|
|
- ctx *context.Context
|
|
|
- url *string
|
|
|
+ ctx *context.Context
|
|
|
+ url *string
|
|
|
+ lang *models.Language
|
|
|
}
|
|
|
|
|
|
// ArticleRepositoryMockGetByURLResults contains results of the ArticleRepository.GetByURL
|
|
@@ -403,7 +433,7 @@ func (mmGetByURL *mArticleRepositoryMockGetByURL) Optional() *mArticleRepository
|
|
|
}
|
|
|
|
|
|
// Expect sets up expected params for ArticleRepository.GetByURL
|
|
|
-func (mmGetByURL *mArticleRepositoryMockGetByURL) Expect(ctx context.Context, url string) *mArticleRepositoryMockGetByURL {
|
|
|
+func (mmGetByURL *mArticleRepositoryMockGetByURL) Expect(ctx context.Context, url string, lang models.Language) *mArticleRepositoryMockGetByURL {
|
|
|
if mmGetByURL.mock.funcGetByURL != nil {
|
|
|
mmGetByURL.mock.t.Fatalf("ArticleRepositoryMock.GetByURL mock is already set by Set")
|
|
|
}
|
|
@@ -416,7 +446,7 @@ func (mmGetByURL *mArticleRepositoryMockGetByURL) Expect(ctx context.Context, ur
|
|
|
mmGetByURL.mock.t.Fatalf("ArticleRepositoryMock.GetByURL mock is already set by ExpectParams functions")
|
|
|
}
|
|
|
|
|
|
- mmGetByURL.defaultExpectation.params = &ArticleRepositoryMockGetByURLParams{ctx, url}
|
|
|
+ mmGetByURL.defaultExpectation.params = &ArticleRepositoryMockGetByURLParams{ctx, url, lang}
|
|
|
for _, e := range mmGetByURL.expectations {
|
|
|
if minimock.Equal(e.params, mmGetByURL.defaultExpectation.params) {
|
|
|
mmGetByURL.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByURL.defaultExpectation.params)
|
|
@@ -470,8 +500,30 @@ func (mmGetByURL *mArticleRepositoryMockGetByURL) ExpectUrlParam2(url string) *m
|
|
|
return mmGetByURL
|
|
|
}
|
|
|
|
|
|
+// ExpectLangParam3 sets up expected param lang for ArticleRepository.GetByURL
|
|
|
+func (mmGetByURL *mArticleRepositoryMockGetByURL) ExpectLangParam3(lang models.Language) *mArticleRepositoryMockGetByURL {
|
|
|
+ if mmGetByURL.mock.funcGetByURL != nil {
|
|
|
+ mmGetByURL.mock.t.Fatalf("ArticleRepositoryMock.GetByURL mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetByURL.defaultExpectation == nil {
|
|
|
+ mmGetByURL.defaultExpectation = &ArticleRepositoryMockGetByURLExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetByURL.defaultExpectation.params != nil {
|
|
|
+ mmGetByURL.mock.t.Fatalf("ArticleRepositoryMock.GetByURL mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetByURL.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmGetByURL.defaultExpectation.paramPtrs = &ArticleRepositoryMockGetByURLParamPtrs{}
|
|
|
+ }
|
|
|
+ mmGetByURL.defaultExpectation.paramPtrs.lang = &lang
|
|
|
+
|
|
|
+ return mmGetByURL
|
|
|
+}
|
|
|
+
|
|
|
// Inspect accepts an inspector function that has same arguments as the ArticleRepository.GetByURL
|
|
|
-func (mmGetByURL *mArticleRepositoryMockGetByURL) Inspect(f func(ctx context.Context, url string)) *mArticleRepositoryMockGetByURL {
|
|
|
+func (mmGetByURL *mArticleRepositoryMockGetByURL) Inspect(f func(ctx context.Context, url string, lang models.Language)) *mArticleRepositoryMockGetByURL {
|
|
|
if mmGetByURL.mock.inspectFuncGetByURL != nil {
|
|
|
mmGetByURL.mock.t.Fatalf("Inspect function is already set for ArticleRepositoryMock.GetByURL")
|
|
|
}
|
|
@@ -495,7 +547,7 @@ func (mmGetByURL *mArticleRepositoryMockGetByURL) Return(ap1 *models.Article, er
|
|
|
}
|
|
|
|
|
|
// Set uses given function f to mock the ArticleRepository.GetByURL method
|
|
|
-func (mmGetByURL *mArticleRepositoryMockGetByURL) Set(f func(ctx context.Context, url string) (ap1 *models.Article, err error)) *ArticleRepositoryMock {
|
|
|
+func (mmGetByURL *mArticleRepositoryMockGetByURL) Set(f func(ctx context.Context, url string, lang models.Language) (ap1 *models.Article, err error)) *ArticleRepositoryMock {
|
|
|
if mmGetByURL.defaultExpectation != nil {
|
|
|
mmGetByURL.mock.t.Fatalf("Default expectation is already set for the ArticleRepository.GetByURL method")
|
|
|
}
|
|
@@ -510,14 +562,14 @@ func (mmGetByURL *mArticleRepositoryMockGetByURL) Set(f func(ctx context.Context
|
|
|
|
|
|
// When sets expectation for the ArticleRepository.GetByURL which will trigger the result defined by the following
|
|
|
// Then helper
|
|
|
-func (mmGetByURL *mArticleRepositoryMockGetByURL) When(ctx context.Context, url string) *ArticleRepositoryMockGetByURLExpectation {
|
|
|
+func (mmGetByURL *mArticleRepositoryMockGetByURL) When(ctx context.Context, url string, lang models.Language) *ArticleRepositoryMockGetByURLExpectation {
|
|
|
if mmGetByURL.mock.funcGetByURL != nil {
|
|
|
mmGetByURL.mock.t.Fatalf("ArticleRepositoryMock.GetByURL mock is already set by Set")
|
|
|
}
|
|
|
|
|
|
expectation := &ArticleRepositoryMockGetByURLExpectation{
|
|
|
mock: mmGetByURL.mock,
|
|
|
- params: &ArticleRepositoryMockGetByURLParams{ctx, url},
|
|
|
+ params: &ArticleRepositoryMockGetByURLParams{ctx, url, lang},
|
|
|
}
|
|
|
mmGetByURL.expectations = append(mmGetByURL.expectations, expectation)
|
|
|
return expectation
|
|
@@ -550,15 +602,15 @@ func (mmGetByURL *mArticleRepositoryMockGetByURL) invocationsDone() bool {
|
|
|
}
|
|
|
|
|
|
// GetByURL implements handler.ArticleRepository
|
|
|
-func (mmGetByURL *ArticleRepositoryMock) GetByURL(ctx context.Context, url string) (ap1 *models.Article, err error) {
|
|
|
+func (mmGetByURL *ArticleRepositoryMock) GetByURL(ctx context.Context, url string, lang models.Language) (ap1 *models.Article, err error) {
|
|
|
mm_atomic.AddUint64(&mmGetByURL.beforeGetByURLCounter, 1)
|
|
|
defer mm_atomic.AddUint64(&mmGetByURL.afterGetByURLCounter, 1)
|
|
|
|
|
|
if mmGetByURL.inspectFuncGetByURL != nil {
|
|
|
- mmGetByURL.inspectFuncGetByURL(ctx, url)
|
|
|
+ mmGetByURL.inspectFuncGetByURL(ctx, url, lang)
|
|
|
}
|
|
|
|
|
|
- mm_params := ArticleRepositoryMockGetByURLParams{ctx, url}
|
|
|
+ mm_params := ArticleRepositoryMockGetByURLParams{ctx, url, lang}
|
|
|
|
|
|
// Record call args
|
|
|
mmGetByURL.GetByURLMock.mutex.Lock()
|
|
@@ -577,7 +629,7 @@ func (mmGetByURL *ArticleRepositoryMock) GetByURL(ctx context.Context, url strin
|
|
|
mm_want := mmGetByURL.GetByURLMock.defaultExpectation.params
|
|
|
mm_want_ptrs := mmGetByURL.GetByURLMock.defaultExpectation.paramPtrs
|
|
|
|
|
|
- mm_got := ArticleRepositoryMockGetByURLParams{ctx, url}
|
|
|
+ mm_got := ArticleRepositoryMockGetByURLParams{ctx, url, lang}
|
|
|
|
|
|
if mm_want_ptrs != nil {
|
|
|
|
|
@@ -589,6 +641,10 @@ func (mmGetByURL *ArticleRepositoryMock) GetByURL(ctx context.Context, url strin
|
|
|
mmGetByURL.t.Errorf("ArticleRepositoryMock.GetByURL got unexpected parameter url, want: %#v, got: %#v%s\n", *mm_want_ptrs.url, mm_got.url, minimock.Diff(*mm_want_ptrs.url, mm_got.url))
|
|
|
}
|
|
|
|
|
|
+ if mm_want_ptrs.lang != nil && !minimock.Equal(*mm_want_ptrs.lang, mm_got.lang) {
|
|
|
+ mmGetByURL.t.Errorf("ArticleRepositoryMock.GetByURL got unexpected parameter lang, want: %#v, got: %#v%s\n", *mm_want_ptrs.lang, mm_got.lang, minimock.Diff(*mm_want_ptrs.lang, mm_got.lang))
|
|
|
+ }
|
|
|
+
|
|
|
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
mmGetByURL.t.Errorf("ArticleRepositoryMock.GetByURL got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
}
|
|
@@ -600,9 +656,9 @@ func (mmGetByURL *ArticleRepositoryMock) GetByURL(ctx context.Context, url strin
|
|
|
return (*mm_results).ap1, (*mm_results).err
|
|
|
}
|
|
|
if mmGetByURL.funcGetByURL != nil {
|
|
|
- return mmGetByURL.funcGetByURL(ctx, url)
|
|
|
+ return mmGetByURL.funcGetByURL(ctx, url, lang)
|
|
|
}
|
|
|
- mmGetByURL.t.Fatalf("Unexpected call to ArticleRepositoryMock.GetByURL. %v %v", ctx, url)
|
|
|
+ mmGetByURL.t.Fatalf("Unexpected call to ArticleRepositoryMock.GetByURL. %v %v %v", ctx, url, lang)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -699,12 +755,14 @@ type ArticleRepositoryMockGetPreviewByTagIDExpectation struct {
|
|
|
type ArticleRepositoryMockGetPreviewByTagIDParams struct {
|
|
|
ctx context.Context
|
|
|
tagID uint64
|
|
|
+ lang models.Language
|
|
|
}
|
|
|
|
|
|
// ArticleRepositoryMockGetPreviewByTagIDParamPtrs contains pointers to parameters of the ArticleRepository.GetPreviewByTagID
|
|
|
type ArticleRepositoryMockGetPreviewByTagIDParamPtrs struct {
|
|
|
ctx *context.Context
|
|
|
tagID *uint64
|
|
|
+ lang *models.Language
|
|
|
}
|
|
|
|
|
|
// ArticleRepositoryMockGetPreviewByTagIDResults contains results of the ArticleRepository.GetPreviewByTagID
|
|
@@ -724,7 +782,7 @@ func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Optional() *
|
|
|
}
|
|
|
|
|
|
// Expect sets up expected params for ArticleRepository.GetPreviewByTagID
|
|
|
-func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Expect(ctx context.Context, tagID uint64) *mArticleRepositoryMockGetPreviewByTagID {
|
|
|
+func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Expect(ctx context.Context, tagID uint64, lang models.Language) *mArticleRepositoryMockGetPreviewByTagID {
|
|
|
if mmGetPreviewByTagID.mock.funcGetPreviewByTagID != nil {
|
|
|
mmGetPreviewByTagID.mock.t.Fatalf("ArticleRepositoryMock.GetPreviewByTagID mock is already set by Set")
|
|
|
}
|
|
@@ -737,7 +795,7 @@ func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Expect(ctx c
|
|
|
mmGetPreviewByTagID.mock.t.Fatalf("ArticleRepositoryMock.GetPreviewByTagID mock is already set by ExpectParams functions")
|
|
|
}
|
|
|
|
|
|
- mmGetPreviewByTagID.defaultExpectation.params = &ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID}
|
|
|
+ mmGetPreviewByTagID.defaultExpectation.params = &ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID, lang}
|
|
|
for _, e := range mmGetPreviewByTagID.expectations {
|
|
|
if minimock.Equal(e.params, mmGetPreviewByTagID.defaultExpectation.params) {
|
|
|
mmGetPreviewByTagID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetPreviewByTagID.defaultExpectation.params)
|
|
@@ -791,8 +849,30 @@ func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) ExpectTagIDP
|
|
|
return mmGetPreviewByTagID
|
|
|
}
|
|
|
|
|
|
+// ExpectLangParam3 sets up expected param lang for ArticleRepository.GetPreviewByTagID
|
|
|
+func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) ExpectLangParam3(lang models.Language) *mArticleRepositoryMockGetPreviewByTagID {
|
|
|
+ if mmGetPreviewByTagID.mock.funcGetPreviewByTagID != nil {
|
|
|
+ mmGetPreviewByTagID.mock.t.Fatalf("ArticleRepositoryMock.GetPreviewByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetPreviewByTagID.defaultExpectation == nil {
|
|
|
+ mmGetPreviewByTagID.defaultExpectation = &ArticleRepositoryMockGetPreviewByTagIDExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetPreviewByTagID.defaultExpectation.params != nil {
|
|
|
+ mmGetPreviewByTagID.mock.t.Fatalf("ArticleRepositoryMock.GetPreviewByTagID mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmGetPreviewByTagID.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmGetPreviewByTagID.defaultExpectation.paramPtrs = &ArticleRepositoryMockGetPreviewByTagIDParamPtrs{}
|
|
|
+ }
|
|
|
+ mmGetPreviewByTagID.defaultExpectation.paramPtrs.lang = &lang
|
|
|
+
|
|
|
+ return mmGetPreviewByTagID
|
|
|
+}
|
|
|
+
|
|
|
// Inspect accepts an inspector function that has same arguments as the ArticleRepository.GetPreviewByTagID
|
|
|
-func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Inspect(f func(ctx context.Context, tagID uint64)) *mArticleRepositoryMockGetPreviewByTagID {
|
|
|
+func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Inspect(f func(ctx context.Context, tagID uint64, lang models.Language)) *mArticleRepositoryMockGetPreviewByTagID {
|
|
|
if mmGetPreviewByTagID.mock.inspectFuncGetPreviewByTagID != nil {
|
|
|
mmGetPreviewByTagID.mock.t.Fatalf("Inspect function is already set for ArticleRepositoryMock.GetPreviewByTagID")
|
|
|
}
|
|
@@ -816,7 +896,7 @@ func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Return(aa1 [
|
|
|
}
|
|
|
|
|
|
// Set uses given function f to mock the ArticleRepository.GetPreviewByTagID method
|
|
|
-func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Set(f func(ctx context.Context, tagID uint64) (aa1 []models.ArticlePreview, err error)) *ArticleRepositoryMock {
|
|
|
+func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Set(f func(ctx context.Context, tagID uint64, lang models.Language) (aa1 []models.ArticlePreview, err error)) *ArticleRepositoryMock {
|
|
|
if mmGetPreviewByTagID.defaultExpectation != nil {
|
|
|
mmGetPreviewByTagID.mock.t.Fatalf("Default expectation is already set for the ArticleRepository.GetPreviewByTagID method")
|
|
|
}
|
|
@@ -831,14 +911,14 @@ func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) Set(f func(c
|
|
|
|
|
|
// When sets expectation for the ArticleRepository.GetPreviewByTagID which will trigger the result defined by the following
|
|
|
// Then helper
|
|
|
-func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) When(ctx context.Context, tagID uint64) *ArticleRepositoryMockGetPreviewByTagIDExpectation {
|
|
|
+func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) When(ctx context.Context, tagID uint64, lang models.Language) *ArticleRepositoryMockGetPreviewByTagIDExpectation {
|
|
|
if mmGetPreviewByTagID.mock.funcGetPreviewByTagID != nil {
|
|
|
mmGetPreviewByTagID.mock.t.Fatalf("ArticleRepositoryMock.GetPreviewByTagID mock is already set by Set")
|
|
|
}
|
|
|
|
|
|
expectation := &ArticleRepositoryMockGetPreviewByTagIDExpectation{
|
|
|
mock: mmGetPreviewByTagID.mock,
|
|
|
- params: &ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID},
|
|
|
+ params: &ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID, lang},
|
|
|
}
|
|
|
mmGetPreviewByTagID.expectations = append(mmGetPreviewByTagID.expectations, expectation)
|
|
|
return expectation
|
|
@@ -871,15 +951,15 @@ func (mmGetPreviewByTagID *mArticleRepositoryMockGetPreviewByTagID) invocationsD
|
|
|
}
|
|
|
|
|
|
// GetPreviewByTagID implements handler.ArticleRepository
|
|
|
-func (mmGetPreviewByTagID *ArticleRepositoryMock) GetPreviewByTagID(ctx context.Context, tagID uint64) (aa1 []models.ArticlePreview, err error) {
|
|
|
+func (mmGetPreviewByTagID *ArticleRepositoryMock) GetPreviewByTagID(ctx context.Context, tagID uint64, lang models.Language) (aa1 []models.ArticlePreview, err error) {
|
|
|
mm_atomic.AddUint64(&mmGetPreviewByTagID.beforeGetPreviewByTagIDCounter, 1)
|
|
|
defer mm_atomic.AddUint64(&mmGetPreviewByTagID.afterGetPreviewByTagIDCounter, 1)
|
|
|
|
|
|
if mmGetPreviewByTagID.inspectFuncGetPreviewByTagID != nil {
|
|
|
- mmGetPreviewByTagID.inspectFuncGetPreviewByTagID(ctx, tagID)
|
|
|
+ mmGetPreviewByTagID.inspectFuncGetPreviewByTagID(ctx, tagID, lang)
|
|
|
}
|
|
|
|
|
|
- mm_params := ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID}
|
|
|
+ mm_params := ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID, lang}
|
|
|
|
|
|
// Record call args
|
|
|
mmGetPreviewByTagID.GetPreviewByTagIDMock.mutex.Lock()
|
|
@@ -898,7 +978,7 @@ func (mmGetPreviewByTagID *ArticleRepositoryMock) GetPreviewByTagID(ctx context.
|
|
|
mm_want := mmGetPreviewByTagID.GetPreviewByTagIDMock.defaultExpectation.params
|
|
|
mm_want_ptrs := mmGetPreviewByTagID.GetPreviewByTagIDMock.defaultExpectation.paramPtrs
|
|
|
|
|
|
- mm_got := ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID}
|
|
|
+ mm_got := ArticleRepositoryMockGetPreviewByTagIDParams{ctx, tagID, lang}
|
|
|
|
|
|
if mm_want_ptrs != nil {
|
|
|
|
|
@@ -910,6 +990,10 @@ func (mmGetPreviewByTagID *ArticleRepositoryMock) GetPreviewByTagID(ctx context.
|
|
|
mmGetPreviewByTagID.t.Errorf("ArticleRepositoryMock.GetPreviewByTagID got unexpected parameter tagID, want: %#v, got: %#v%s\n", *mm_want_ptrs.tagID, mm_got.tagID, minimock.Diff(*mm_want_ptrs.tagID, mm_got.tagID))
|
|
|
}
|
|
|
|
|
|
+ if mm_want_ptrs.lang != nil && !minimock.Equal(*mm_want_ptrs.lang, mm_got.lang) {
|
|
|
+ mmGetPreviewByTagID.t.Errorf("ArticleRepositoryMock.GetPreviewByTagID got unexpected parameter lang, want: %#v, got: %#v%s\n", *mm_want_ptrs.lang, mm_got.lang, minimock.Diff(*mm_want_ptrs.lang, mm_got.lang))
|
|
|
+ }
|
|
|
+
|
|
|
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
mmGetPreviewByTagID.t.Errorf("ArticleRepositoryMock.GetPreviewByTagID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
}
|
|
@@ -921,9 +1005,9 @@ func (mmGetPreviewByTagID *ArticleRepositoryMock) GetPreviewByTagID(ctx context.
|
|
|
return (*mm_results).aa1, (*mm_results).err
|
|
|
}
|
|
|
if mmGetPreviewByTagID.funcGetPreviewByTagID != nil {
|
|
|
- return mmGetPreviewByTagID.funcGetPreviewByTagID(ctx, tagID)
|
|
|
+ return mmGetPreviewByTagID.funcGetPreviewByTagID(ctx, tagID, lang)
|
|
|
}
|
|
|
- mmGetPreviewByTagID.t.Fatalf("Unexpected call to ArticleRepositoryMock.GetPreviewByTagID. %v %v", ctx, tagID)
|
|
|
+ mmGetPreviewByTagID.t.Fatalf("Unexpected call to ArticleRepositoryMock.GetPreviewByTagID. %v %v %v", ctx, tagID, lang)
|
|
|
return
|
|
|
}
|
|
|
|