net_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/aegis/model/net"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestServiceGetNetList(t *testing.T) {
  9. var (
  10. c = context.TODO()
  11. pm = &net.ListNetParam{}
  12. )
  13. convey.Convey("GetNetList", t, func(ctx convey.C) {
  14. result, err := s.GetNetList(c, pm)
  15. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(result, convey.ShouldNotBeNil)
  18. })
  19. })
  20. }
  21. func TestServiceShowNet(t *testing.T) {
  22. var (
  23. c = context.TODO()
  24. id = int64(1)
  25. )
  26. convey.Convey("ShowNet", t, func(ctx convey.C) {
  27. r, err := s.ShowNet(c, id)
  28. ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(r, convey.ShouldNotBeNil)
  31. })
  32. })
  33. }
  34. func TestServicenetCheckUnique(t *testing.T) {
  35. var (
  36. chName = ""
  37. )
  38. convey.Convey("netCheckUnique", t, func(ctx convey.C) {
  39. err, msg := s.netCheckUnique(cntx, chName)
  40. ctx.Convey("Then err should be nil.msg should not be nil.", func(ctx convey.C) {
  41. ctx.So(msg, convey.ShouldNotBeNil)
  42. ctx.So(err, convey.ShouldBeNil)
  43. })
  44. })
  45. }