123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package service
- import (
- "testing"
- . "github.com/smartystreets/goconvey/convey"
- "go-common/app/admin/ep/melloi/model"
- )
- var (
- label = model.Label{
- ID: 1,
- Name: "name",
- Description: "description",
- Color: "#602230",
- Active: 1,
- }
- lr = model.LabelRelation{
- ID: 1,
- LabelID: 1,
- LabelName: "name",
- Color: "#602230",
- Description: "description",
- TargetID: 1,
- Type: 1,
- Active: 1,
- }
- ids = []int64{1, 2, 3, 4, 5}
- )
- func Test_Label(t *testing.T) {
- Convey("add label", t, func() {
- err := s.AddLabel(&label)
- So(err, ShouldBeNil)
- })
- Convey("query label", t, func() {
- _, err := s.QueryLabel(c)
- So(err, ShouldBeNil)
- })
- Convey("delete label", t, func() {
- err := s.DeleteLabel(label.ID)
- So(err, ShouldBeNil)
- })
- Convey("delete label relation", t, func() {
- err := s.AddLabelRelation(&lr)
- So(err, ShouldBeNil)
- })
- Convey("delete label relation", t, func() {
- err := s.DeleteLabelRelation(lr.ID)
- So(err, ShouldBeNil)
- })
- Convey("query label relation", t, func() {
- _, err := s.QueryLabelRelation(&lr)
- So(err, ShouldBeNil)
- })
- Convey("query label relation by ids", t, func() {
- _, err := s.QueryLabelRelationByIDs(ids)
- So(err, ShouldBeNil)
- })
- }
|