business_test.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package gorm
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/aegis/model/business"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestEnableBusiness(t *testing.T) {
  9. convey.Convey("EnableBusiness", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. err := d.EnableBusiness(c, 0)
  15. ctx.Convey("Then err should be nil.cfgs should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDisableBusiness(t *testing.T) {
  22. convey.Convey("DisableBusiness", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. )
  26. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  27. err := d.DisableBusiness(c, 0)
  28. ctx.Convey("Then err should be nil.cfgs should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. })
  31. })
  32. })
  33. }
  34. func TestBusiness(t *testing.T) {
  35. convey.Convey("Business", t, func(ctx convey.C) {
  36. var (
  37. c = context.Background()
  38. )
  39. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  40. _, err := d.Business(c, 0)
  41. ctx.Convey("Then err should be nil.cfgs should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. })
  44. })
  45. })
  46. }
  47. func TestBusinessList(t *testing.T) {
  48. convey.Convey("BusinessList", t, func(ctx convey.C) {
  49. var (
  50. c = context.Background()
  51. )
  52. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  53. _, err := d.BusinessList(c, 1, []int64{0}, true)
  54. ctx.Convey("Then err should be nil.cfgs should not be nil.", func(ctx convey.C) {
  55. ctx.So(err, convey.ShouldBeNil)
  56. })
  57. })
  58. })
  59. }
  60. func TestUpdateBusiness(t *testing.T) {
  61. convey.Convey("UpdateBusiness", t, func(ctx convey.C) {
  62. var (
  63. c = context.Background()
  64. )
  65. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  66. err := d.UpdateBusiness(c, &business.Business{})
  67. ctx.Convey("Then err should be nil", func(ctx convey.C) {
  68. ctx.So(err, convey.ShouldBeNil)
  69. })
  70. })
  71. })
  72. }