- had to add a Type field to interface DbEntry so that db.List()
is able to distinguish between Upload and Form properly.
- added form describe and delete commands
- added --query parameter to form+upload list for filtering
This commit is contained in:
2023-03-30 10:22:57 +02:00
parent 26f2b25e22
commit 8a791d8017
13 changed files with 208 additions and 40 deletions

View File

@@ -72,12 +72,13 @@ var dbtests = []struct {
context string
ts string
filter string
query string
upload common.Upload
form common.Form
}{
{
"upload", "test.db", false, "1", "foo",
"2023-03-10T11:45:00.000Z", "",
"2023-03-10T11:45:00.000Z", "", "",
common.Upload{
Id: "1", Expire: "asap", File: "none", Context: "foo",
Created: common.Timestamp{}},
@@ -85,7 +86,7 @@ var dbtests = []struct {
},
{
"form", "test.db", false, "2", "foo",
"2023-03-10T11:45:00.000Z", "",
"2023-03-10T11:45:00.000Z", "", "",
common.Upload{},
common.Form{
Id: "1", Expire: "asap", Description: "none", Context: "foo",
@@ -149,7 +150,7 @@ func TestDboperation(t *testing.T) {
td.Cmp(t, response.Uploads[0], &tt.upload, tt.name)
// fetch list
response, err = db.List(tt.context, tt.filter, common.TypeUpload)
response, err = db.List(tt.context, tt.filter, tt.query, common.TypeUpload)
if err != nil {
t.Errorf("Could not fetch uploads list: " + err.Error())
}
@@ -211,7 +212,7 @@ func TestDboperation(t *testing.T) {
td.Cmp(t, response.Forms[0], &tt.form, tt.name)
// fetch list
response, err = db.List(tt.context, tt.filter, common.TypeForm)
response, err = db.List(tt.context, tt.filter, tt.query, common.TypeForm)
if err != nil {
t.Errorf("Could not fetch forms list: " + err.Error())
}