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. // Marker represents an image marker edit form.
type Marker struct { type Marker struct {
MarkerType string `json:"Type"` MarkerType string `json:"Type"`
MarkerSrc string `json:"Src"` MarkerSrc string `json:"Src"`
MarkerName string `json:"Name"` MarkerName string `json:"Name"`
SubjectUID string `json:"SubjectUID"` SubjectUID string `json:"SubjectUID"`
SubjectSrc string `json:"SubjectSrc"` SubjectSrc string `json:"SubjectSrc"`
Score int `json:"Score"` Score int `json:"Score"`
Invalid bool `json:"Invalid"` MarkerInvalid bool `json:"Invalid"`
} }
func NewMarker(m interface{}) (f Marker, err error) { func NewMarker(m interface{}) (f Marker, err error) {

View file

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