123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- package dao
- import (
- "context"
- "go-common/app/admin/main/search/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoBusinessList(t *testing.T) {
- convey.Convey("BusinessList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- name = ""
- offset = int(0)
- limit = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.BusinessList(c, name, offset, limit)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- //ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoBusinessTotal(t *testing.T) {
- convey.Convey("BusinessTotal", t, func(ctx convey.C) {
- var (
- c = context.Background()
- name = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- total, err := d.BusinessTotal(c, name)
- ctx.Convey("Then err should be nil.total should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(total, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoBusinessAll(t *testing.T) {
- convey.Convey("BusinessAll", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- list, err := d.BusinessAll(c)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddBusiness(t *testing.T) {
- convey.Convey("AddBusiness", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // b = &model.MngBusiness{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // id, _ := d.AddBusiness(c, b)
- // ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- // //ctx.So(err, convey.ShouldBeNil)
- // ctx.So(id, convey.ShouldNotBeNil)
- // })
- //})
- })
- }
- func TestDaoUpdateBusiness(t *testing.T) {
- convey.Convey("UpdateBusiness", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // b = &model.MngBusiness{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // err := d.UpdateBusiness(c, b)
- // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- // ctx.So(err, convey.ShouldBeNil)
- // })
- //})
- })
- }
- func TestDaoBusinessInfo(t *testing.T) {
- convey.Convey("BusinessInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.BusinessInfo(c, id)
- ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- //ctx.So(info, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoBusinessInfoByName(t *testing.T) {
- convey.Convey("BusinessInfoByName", t, func(ctx convey.C) {
- var (
- c = context.Background()
- name = "log"
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- info, err := d.BusinessInfoByName(c, name)
- ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(info, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAssetList(t *testing.T) {
- convey.Convey("AssetList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int(0)
- name = ""
- offset = int(0)
- limit = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.AssetList(c, typ, name, offset, limit)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- //ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAssetTotal(t *testing.T) {
- convey.Convey("AssetTotal", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int(0)
- name = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- total, err := d.AssetTotal(c, typ, name)
- ctx.Convey("Then err should be nil.total should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(total, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAssetAll(t *testing.T) {
- convey.Convey("AssetAll", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- list, err := d.AssetAll(c)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAssetInfo(t *testing.T) {
- convey.Convey("AssetInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.AssetInfo(c, id)
- ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- //ctx.So(info, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAssetInfoByName(t *testing.T) {
- convey.Convey("AssetInfoByName", t, func(ctx convey.C) {
- var (
- c = context.Background()
- name = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- info, err := d.AssetInfoByName(c, name)
- ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(info, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddAsset(t *testing.T) {
- convey.Convey("AddAsset", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // b = &model.MngAsset{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // //id, err :=
- // d.AddAsset(c, b)
- // ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- // //ctx.So(err, convey.ShouldBeNil)
- // //ctx.So(id, convey.ShouldNotBeNil)
- // })
- //})
- })
- }
- func TestDaoUpdateAsset(t *testing.T) {
- convey.Convey("UpdateAsset", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // b = &model.MngAsset{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // err := d.UpdateAsset(c, b)
- // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- // ctx.So(err, convey.ShouldBeNil)
- // })
- //})
- })
- }
- func TestDaoAppList(t *testing.T) {
- convey.Convey("AppList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- business = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- list, err := d.AppList(c, business)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAppInfo(t *testing.T) {
- convey.Convey("AppInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- //a, err :=
- d.AppInfo(c, id)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- //ctx.So(err, convey.ShouldBeNil)
- //ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAppInfoByAppid(t *testing.T) {
- convey.Convey("AppInfoByAppid", t, func(ctx convey.C) {
- var (
- c = context.Background()
- appid = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.AppInfoByAppid(c, appid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddApp(t *testing.T) {
- convey.Convey("AddApp", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // a = &model.MngApp{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // id, err :=
- // d.AddApp(c, a)
- // ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- // ctx.So(err, convey.ShouldBeNil)
- // ctx.So(id, convey.ShouldNotBeNil)
- // })
- //})
- })
- }
- func TestDaoUpdateApp(t *testing.T) {
- convey.Convey("UpdateApp", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // a = &model.MngApp{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // err := d.UpdateApp(c, a)
- // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- // ctx.So(err, convey.ShouldBeNil)
- // })
- //})
- })
- }
- func TestDaoUpdateAppAssetTable(t *testing.T) {
- convey.Convey("UpdateAppAssetTable", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // name = ""
- // no = &model.MngAssetTable{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // err := d.UpdateAppAssetTable(c, name, no)
- // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- // ctx.So(err, convey.ShouldBeNil)
- // })
- //})
- })
- }
- func TestDaoUpdateAppAssetDatabus(t *testing.T) {
- convey.Convey("UpdateAppAssetDatabus", t, func(ctx convey.C) {
- //var (
- // c = context.Background()
- // name = ""
- // v = &model.MngAssetDatabus{}
- //)
- //ctx.Convey("When everything goes positive", func(ctx convey.C) {
- // err := d.UpdateAppAssetDatabus(c, name, v)
- // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- // ctx.So(err, convey.ShouldBeNil)
- // })
- //})
- })
- }
- func TestDaoMngCount(t *testing.T) {
- convey.Convey("MngCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- v = &model.MngCount{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- list, err := d.MngCount(c, v)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMngPercent(t *testing.T) {
- convey.Convey("MngPercent", t, func(ctx convey.C) {
- var (
- c = context.Background()
- v = &model.MngCount{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- list, err := d.MngPercent(c, v)
- ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(list, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUnames(t *testing.T) {
- convey.Convey("Unames", t, func(ctx convey.C) {
- var (
- c = context.Background()
- uids = []string{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.Unames(c, uids)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
|