People: Revert marker form and test #22

This commit is contained in:
Michael Mayer 2021-08-16 01:52:02 +02:00
parent 003982afe0
commit c315c58bb5
2 changed files with 22 additions and 22 deletions

View file

@ -4,13 +4,13 @@ import "github.com/ulule/deepcopier"
// Marker represents an image marker edit form.
type Marker struct {
MarkerType string `json:"Type"`
MarkerSrc string `json:"Src"`
MarkerName string `json:"Name"`
SubjectUID string `json:"SubjectUID"`
SubjectSrc string `json:"SubjectSrc"`
Score int `json:"Score"`
Invalid bool `json:"Invalid"`
MarkerType string `json:"Type"`
MarkerSrc string `json:"Src"`
MarkerName string `json:"Name"`
SubjectUID string `json:"SubjectUID"`
SubjectSrc string `json:"SubjectSrc"`
Score int `json:"Score"`
MarkerInvalid bool `json:"Invalid"`
}
func NewMarker(m interface{}) (f Marker, err error) {

View file

@ -9,21 +9,21 @@ import (
func TestNewMarker(t *testing.T) {
t.Run("success", func(t *testing.T) {
var m = struct {
MarkerType string
MarkerSrc string
MarkerName string
SubjectUID string
SubjectSrc string
Score int
Invalid bool
MarkerType string
MarkerSrc string
MarkerName string
SubjectUID string
SubjectSrc string
Score int
MarkerInvalid bool
}{
MarkerType: "face",
MarkerSrc: "image",
MarkerName: "Foo",
SubjectUID: "3h59wvth837b5vyiub35",
SubjectSrc: "meta",
Score: 100,
Invalid: true,
MarkerType: "face",
MarkerSrc: "image",
MarkerName: "Foo",
SubjectUID: "3h59wvth837b5vyiub35",
SubjectSrc: "meta",
Score: 100,
MarkerInvalid: true,
}
f, err := NewMarker(m)
@ -38,6 +38,6 @@ func TestNewMarker(t *testing.T) {
assert.Equal(t, "3h59wvth837b5vyiub35", f.SubjectUID)
assert.Equal(t, "meta", f.SubjectSrc)
assert.Equal(t, 100, f.Score)
assert.Equal(t, true, f.Invalid)
assert.Equal(t, true, f.MarkerInvalid)
})
}