file_test.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package v2
  2. import (
  3. "go-common/app/infra/config/model"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestV2SetFile(t *testing.T) {
  8. var (
  9. name = "main.common-arch.apm-admin_460"
  10. conf = &model.Content{}
  11. )
  12. convey.Convey("SetFile", t, func(ctx convey.C) {
  13. err := d.SetFile(name, conf)
  14. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. })
  17. })
  18. }
  19. func TestV2File(t *testing.T) {
  20. var (
  21. name = "main.common-arch.apm-admin_460"
  22. )
  23. convey.Convey("File", t, func(ctx convey.C) {
  24. res, err := d.File(name)
  25. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  26. ctx.So(err, convey.ShouldBeNil)
  27. ctx.So(res, convey.ShouldNotBeNil)
  28. })
  29. })
  30. }
  31. func TestV2DelFile(t *testing.T) {
  32. var (
  33. name = "main.common-arch.apm-admin_460"
  34. )
  35. convey.Convey("DelFile", t, func(ctx convey.C) {
  36. err := d.DelFile(name)
  37. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  38. ctx.So(err, convey.ShouldBeNil)
  39. })
  40. })
  41. }
  42. func TestV2SetFileStr(t *testing.T) {
  43. var (
  44. name = "main.common-arch.apm-admin_460"
  45. val = "test"
  46. )
  47. convey.Convey("SetFileStr", t, func(ctx convey.C) {
  48. err := d.SetFileStr(name, val)
  49. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  50. ctx.So(err, convey.ShouldBeNil)
  51. })
  52. })
  53. }
  54. func TestV2FileStr(t *testing.T) {
  55. var (
  56. name = "main.common-arch.apm-admin_460"
  57. )
  58. convey.Convey("FileStr", t, func(ctx convey.C) {
  59. file, err := d.FileStr(name)
  60. ctx.Convey("Then err should be nil.file should not be nil.", func(ctx convey.C) {
  61. ctx.So(err, convey.ShouldBeNil)
  62. ctx.So(file, convey.ShouldNotBeNil)
  63. })
  64. })
  65. }