config_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package v2
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestV2UpdateConfValue(t *testing.T) {
  7. var (
  8. ID = int64(0)
  9. value = ""
  10. )
  11. convey.Convey("UpdateConfValue", t, func(ctx convey.C) {
  12. err := d.UpdateConfValue(ID, value)
  13. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  14. ctx.So(err, convey.ShouldBeNil)
  15. })
  16. })
  17. }
  18. func TestV2UpdateConfState(t *testing.T) {
  19. var (
  20. ID = int64(855)
  21. state = int8(0)
  22. state2 = int8(2)
  23. )
  24. convey.Convey("UpdateConfState", t, func(ctx convey.C) {
  25. err := d.UpdateConfState(ID, state)
  26. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  27. ctx.So(err, convey.ShouldBeNil)
  28. })
  29. })
  30. convey.Convey("UpdateConfState restoration", t, func(ctx convey.C) {
  31. err := d.UpdateConfState(ID, state2)
  32. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. })
  35. })
  36. }
  37. func TestV2ConfigsByIDs(t *testing.T) {
  38. var (
  39. ids = []int64{855, 788}
  40. )
  41. convey.Convey("ConfigsByIDs", t, func(ctx convey.C) {
  42. confs, err := d.ConfigsByIDs(ids)
  43. ctx.Convey("Then err should be nil.confs should not be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. ctx.So(confs, convey.ShouldNotBeNil)
  46. })
  47. })
  48. }