flow_test.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package gorm
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. "go-common/app/admin/main/aegis/model/net"
  6. )
  7. func TestDaoFlowByID(t *testing.T) {
  8. convey.Convey("FlowByID", t, func(ctx convey.C) {
  9. _, err := d.FlowByID(cntx, 1)
  10. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  11. ctx.So(err, convey.ShouldBeNil)
  12. })
  13. })
  14. }
  15. func TestDaoFlowList(t *testing.T) {
  16. var (
  17. pm = &net.ListNetElementParam{
  18. NetID: 1,
  19. State: net.StateAvailable,
  20. Ps: 5,
  21. Pn: 2,
  22. ID: []int64{1},
  23. Name: "name",
  24. }
  25. )
  26. convey.Convey("FlowList", t, func(ctx convey.C) {
  27. result, err := d.FlowList(cntx, pm)
  28. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(result, convey.ShouldNotBeNil)
  31. })
  32. })
  33. }
  34. func TestDaoFlowByUnique(t *testing.T) {
  35. convey.Convey("FlowByUnique", t, func(ctx convey.C) {
  36. _, err := d.FlowByUnique(cntx, 0, "")
  37. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  38. ctx.So(err, convey.ShouldBeNil)
  39. })
  40. })
  41. }
  42. func TestDaoFlowsByNet(t *testing.T) {
  43. convey.Convey("FlowsByNet", t, func(ctx convey.C) {
  44. _, err := d.FlowsByNet(cntx, []int64{})
  45. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. })
  48. })
  49. }
  50. func TestDaoFlows(t *testing.T) {
  51. convey.Convey("Flows", t, func(ctx convey.C) {
  52. _, err := d.Flows(cntx, []int64{})
  53. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  54. ctx.So(err, convey.ShouldBeNil)
  55. })
  56. })
  57. }
  58. func TestDaoFlowIDByNet(t *testing.T) {
  59. convey.Convey("FlowIDByNet", t, func(ctx convey.C) {
  60. _, err := d.FlowIDByNet(cntx, []int64{})
  61. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  62. ctx.So(err, convey.ShouldBeNil)
  63. })
  64. })
  65. }