Saved filters #655

Merged
konrad merged 29 commits from feature/saved-filters into master 2020-09-26 21:02:18 +00:00
1 changed files with 9 additions and 2 deletions
Showing only changes of commit 6bef7896e9 - Show all commits

View File

@ -21,6 +21,7 @@ import (
"code.vikunja.io/api/pkg/user"
"github.com/stretchr/testify/assert"
"testing"
"xorm.io/xorm/schemas"
)
func TestSavedFilter_getListIDFromFilter(t *testing.T) {
@ -53,12 +54,18 @@ func TestSavedFilter_Create(t *testing.T) {
err := sf.Create(u)
assert.NoError(t, err)
assert.Equal(t, u.ID, sf.OwnerID)
db.AssertDBExists(t, "saved_filters", map[string]interface{}{
vals := map[string]interface{}{
"title": "test",
"description": "Lorem Ipsum dolor sit amet",
"filters": "{\"sort_by\":null,\"order_by\":null,\"filter_by\":null,\"filter_value\":null,\"filter_comparator\":null,\"filter_concat\":\"\",\"filter_include_nulls\":false}",
"owner_id": 1,
})
}
// Postgres can't compare json values directly, see https://dba.stackexchange.com/a/106290/210721
if x.Dialect().URI().DBType == schemas.POSTGRES {
delete(vals, "filters")
vals["filters::jsonb"] = "{\"sort_by\":null,\"order_by\":null,\"filter_by\":null,\"filter_value\":null,\"filter_comparator\":null,\"filter_concat\":\"\",\"filter_include_nulls\":false}::jsonb"
}
db.AssertDBExists(t, "saved_filters", vals)
}
func TestSavedFilter_ReadOne(t *testing.T) {