* [MM-42027] - Invitation Email is resent as a Reminder after invalidating pending email invites

* generate app layers mocks

* add tests

* improve err handling

* fix translations

* change status code
Этот коммит содержится в:
Allan Guwatudde
2022-02-25 20:02:08 +03:00
коммит произвёл GitHub
родитель 3c48be040f
Коммит 81f82729d2
13 изменённых файлов: 204 добавлений и 2 удалений

Просмотреть файл

@@ -19,6 +19,7 @@ import (
func TestJobStore(t *testing.T, ss store.Store) {
t.Run("JobSaveGet", func(t *testing.T) { testJobSaveGet(t, ss) })
t.Run("JobGetAllByType", func(t *testing.T) { testJobGetAllByType(t, ss) })
t.Run("JobGetAllByTypeAndStatus", func(t *testing.T) { testJobGetAllByTypeAndStatus(t, ss) })
t.Run("JobGetAllByTypePage", func(t *testing.T) { testJobGetAllByTypePage(t, ss) })
t.Run("JobGetAllByTypesPage", func(t *testing.T) { testJobGetAllByTypesPage(t, ss) })
t.Run("JobGetAllPage", func(t *testing.T) { testJobGetAllPage(t, ss) })
@@ -85,6 +86,34 @@ func testJobGetAllByType(t *testing.T, ss store.Store) {
require.ElementsMatch(t, []string{jobs[0].Id, jobs[1].Id}, []string{received[0].Id, received[1].Id})
}
func testJobGetAllByTypeAndStatus(t *testing.T, ss store.Store) {
jobType := model.NewId()
jobs := []*model.Job{
{
Id: model.NewId(),
Type: jobType,
Status: model.JobStatusPending,
},
{
Id: model.NewId(),
Type: jobType,
Status: model.JobStatusPending,
},
}
for _, job := range jobs {
_, err := ss.Job().Save(job)
require.NoError(t, err)
defer ss.Job().Delete(job.Id)
}
received, err := ss.Job().GetAllByTypeAndStatus(jobType, model.JobStatusPending)
require.NoError(t, err)
require.Len(t, received, 2)
require.ElementsMatch(t, []string{jobs[0].Id, jobs[1].Id}, []string{received[0].Id, received[1].Id})
}
func testJobGetAllByTypePage(t *testing.T, ss store.Store) {
jobType := model.NewId()

Просмотреть файл

@@ -118,6 +118,29 @@ func (_m *JobStore) GetAllByType(jobType string) ([]*model.Job, error) {
return r0, r1
}
// GetAllByTypeAndStatus provides a mock function with given fields: jobType, status
func (_m *JobStore) GetAllByTypeAndStatus(jobType string, status string) ([]*model.Job, error) {
ret := _m.Called(jobType, status)
var r0 []*model.Job
if rf, ok := ret.Get(0).(func(string, string) []*model.Job); ok {
r0 = rf(jobType, status)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Job)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(jobType, status)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAllByTypePage provides a mock function with given fields: jobType, offset, limit
func (_m *JobStore) GetAllByTypePage(jobType string, offset int, limit int) ([]*model.Job, error) {
ret := _m.Called(jobType, offset, limit)