app_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package v2
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestV2AppByTree(t *testing.T) {
  7. var (
  8. zone = ""
  9. env = ""
  10. treeID = int64(0)
  11. )
  12. convey.Convey("AppByTree", t, func(ctx convey.C) {
  13. app, err := d.AppByTree(zone, env, treeID)
  14. ctx.Convey("Then err should be nil.app should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(app, convey.ShouldNotBeNil)
  17. })
  18. })
  19. }
  20. func TestV2AppsByNameEnv(t *testing.T) {
  21. var (
  22. name = "main.common-arch.apm-admin"
  23. env = "fat1"
  24. )
  25. convey.Convey("AppsByNameEnv", t, func(ctx convey.C) {
  26. apps, err := d.AppsByNameEnv(name, env)
  27. ctx.Convey("Then err should be nil.apps should not be nil.", func(ctx convey.C) {
  28. ctx.So(err, convey.ShouldBeNil)
  29. ctx.So(apps, convey.ShouldNotBeNil)
  30. })
  31. })
  32. }
  33. func TestV2AppGet(t *testing.T) {
  34. var (
  35. zone = "sh001"
  36. env = "fat1"
  37. token = "a882c5530bcc11e8ab68522233017188"
  38. )
  39. convey.Convey("AppGet", t, func(ctx convey.C) {
  40. app, err := d.AppGet(zone, env, token)
  41. ctx.Convey("Then err should be nil.app should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. ctx.So(app, convey.ShouldNotBeNil)
  44. })
  45. })
  46. }