2021-06-02 17:25:04 +02:00
|
|
|
package form
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewMarker(t *testing.T) {
|
|
|
|
t.Run("success", func(t *testing.T) {
|
|
|
|
var m = struct {
|
2021-08-12 12:05:10 +02:00
|
|
|
RefUID string
|
2021-06-02 17:25:04 +02:00
|
|
|
RefSrc string
|
|
|
|
MarkerSrc string
|
|
|
|
MarkerType string
|
|
|
|
MarkerScore int
|
|
|
|
MarkerInvalid bool
|
|
|
|
MarkerLabel string
|
|
|
|
}{
|
2021-08-12 12:05:10 +02:00
|
|
|
RefUID: "3h59wvth837b5vyiub35",
|
2021-06-02 17:25:04 +02:00
|
|
|
RefSrc: "meta",
|
|
|
|
MarkerSrc: "image",
|
|
|
|
MarkerType: "Face",
|
|
|
|
MarkerScore: 100,
|
|
|
|
MarkerInvalid: true,
|
|
|
|
MarkerLabel: "Foo",
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err := NewMarker(m)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2021-08-12 12:05:10 +02:00
|
|
|
assert.Equal(t, "3h59wvth837b5vyiub35", f.RefUID)
|
2021-06-02 17:25:04 +02:00
|
|
|
assert.Equal(t, "meta", f.RefSrc)
|
|
|
|
assert.Equal(t, "image", f.MarkerSrc)
|
|
|
|
assert.Equal(t, "Face", f.MarkerType)
|
|
|
|
assert.Equal(t, 100, f.MarkerScore)
|
|
|
|
assert.Equal(t, true, f.MarkerInvalid)
|
|
|
|
assert.Equal(t, "Foo", f.MarkerLabel)
|
|
|
|
})
|
|
|
|
}
|