flow_resource_test.go 894 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package service
  2. import (
  3. "testing"
  4. "github.com/jinzhu/gorm"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestServiceaddFlowResource(t *testing.T) {
  8. var (
  9. tx = &gorm.DB{}
  10. rid = []int64{}
  11. flowID = int64(0)
  12. state = int8(0)
  13. netid = int64(0)
  14. )
  15. convey.Convey("addFlowResources", t, func(ctx convey.C) {
  16. err := s.addFlowResources(tx, netid, rid, flowID, state)
  17. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. })
  20. })
  21. }
  22. func TestServicechangeFlowResource(t *testing.T) {
  23. var (
  24. tx, _ = s.gorm.BeginTx(cntx)
  25. netid = int64(0)
  26. rid = int64(0)
  27. newFlowID = int64(0)
  28. )
  29. convey.Convey("changeFlowResource", t, func(ctx convey.C) {
  30. err := s.updateFlowResources(cntx, tx, netid, rid, newFlowID)
  31. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldBeNil)
  33. })
  34. })
  35. }