Test failing
This commit is contained in:
parent
e7308edd4c
commit
638b4df0e7
3 changed files with 25 additions and 5 deletions
|
@ -24,12 +24,16 @@ func makeExportRequest(ej *xport.ExportJob, url string) *http.Request {
|
||||||
|
|
||||||
perr(body.WriteField("systemID", strconv.Itoa(int(ej.SystemID))))
|
perr(body.WriteField("systemID", strconv.Itoa(int(ej.SystemID))))
|
||||||
|
|
||||||
|
perr(body.WriteField("talkgroups", "3,4"))
|
||||||
|
|
||||||
w, err := body.CreateFormFile("template", ej.TemplateFileName)
|
w, err := body.CreateFormFile("template", ej.TemplateFileName)
|
||||||
perr(err)
|
perr(err)
|
||||||
|
|
||||||
_, err = w.Write(ej.Template)
|
_, err = w.Write(ej.Template)
|
||||||
perr(err)
|
perr(err)
|
||||||
|
|
||||||
|
body.Close()
|
||||||
|
|
||||||
r, err := http.NewRequest(http.MethodPost, url, &buf)
|
r, err := http.NewRequest(http.MethodPost, url, &buf)
|
||||||
perr(err)
|
perr(err)
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ import (
|
||||||
|
|
||||||
"dynatron.me/x/stillbox/pkg/alerting"
|
"dynatron.me/x/stillbox/pkg/alerting"
|
||||||
"dynatron.me/x/stillbox/pkg/config"
|
"dynatron.me/x/stillbox/pkg/config"
|
||||||
|
"dynatron.me/x/stillbox/pkg/talkgroups"
|
||||||
|
"dynatron.me/x/stillbox/pkg/talkgroups/filter"
|
||||||
"dynatron.me/x/stillbox/pkg/talkgroups/tgstore"
|
"dynatron.me/x/stillbox/pkg/talkgroups/tgstore"
|
||||||
"dynatron.me/x/stillbox/pkg/talkgroups/xport"
|
"dynatron.me/x/stillbox/pkg/talkgroups/xport"
|
||||||
|
|
||||||
|
@ -131,6 +133,13 @@ var (
|
||||||
SystemID: 197,
|
SystemID: 197,
|
||||||
Template: []byte("this is a template\n\r\nthingy"),
|
Template: []byte("this is a template\n\r\nthingy"),
|
||||||
TemplateFileName: "template.xml",
|
TemplateFileName: "template.xml",
|
||||||
|
|
||||||
|
TalkgroupFilter: filter.TalkgroupFilter{
|
||||||
|
Talkgroups: []talkgroups.ID{
|
||||||
|
talkgroups.TG(197, 3),
|
||||||
|
talkgroups.TG(197, 4),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -253,6 +262,13 @@ func TestUnmarshal(t *testing.T) {
|
||||||
expect: &ExpJob1,
|
expect: &ExpJob1,
|
||||||
opts: []forms.Option{forms.WithAcceptBlank(), forms.WithOmitEmpty()},
|
opts: []forms.Option{forms.WithAcceptBlank(), forms.WithOmitEmpty()},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "multipart byte field",
|
||||||
|
r: makeExportRequest(&ExpJob1, "http://somewhere/export"),
|
||||||
|
dest: &xport.ExportJob{},
|
||||||
|
expect: &ExpJob1,
|
||||||
|
opts: []forms.Option{forms.WithAcceptBlank(), forms.WithOmitEmpty()},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
|
|
@ -11,11 +11,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type TalkgroupFilter struct {
|
type TalkgroupFilter struct {
|
||||||
Talkgroups []tgsp.ID `json:"talkgroups,omitempty"`
|
Talkgroups []tgsp.ID `json:"talkgroups,omitempty" form:"talkgroups"`
|
||||||
TalkgroupsNot []tgsp.ID `json:"talkgroupsNot,omitempty"`
|
TalkgroupsNot []tgsp.ID `json:"talkgroupsNot,omitempty" form:"talkgroupsNot"`
|
||||||
TalkgroupTagsAll []string `json:"talkgroupTagsAll,omitempty"`
|
TalkgroupTagsAll []string `json:"talkgroupTagsAll,omitempty" form:"talkgroupTagsAll"`
|
||||||
TalkgroupTagsAny []string `json:"talkgroupTagsAny,omitempty"`
|
TalkgroupTagsAny []string `json:"talkgroupTagsAny,omitempty" form:"talkgroupTagsAny"`
|
||||||
TalkgroupTagsNot []string `json:"talkgroupTagsNot,omitempty"`
|
TalkgroupTagsNot []string `json:"talkgroupTagsNot,omitempty" form:"talkgroupTagsNot"`
|
||||||
|
|
||||||
talkgroups map[tgsp.ID]bool `json:"-"`
|
talkgroups map[tgsp.ID]bool `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue