api_test.go 645 B

1234567891011121314151617181920212223242526
  1. package monitor
  2. import (
  3. "context"
  4. "gopkg.in/h2non/gock.v1"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestMonitorArchiveAttr(t *testing.T) {
  9. convey.Convey("ArchiveAttr", t, func(convCtx convey.C) {
  10. var (
  11. c = context.Background()
  12. aid = int64(1212)
  13. )
  14. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  15. defer gock.OffAll()
  16. httpMock("GET", d.URLArcAddit).Reply(200).JSON(`{"code":0,"data":{}}`)
  17. _, err := d.ArchiveAttr(c, aid)
  18. convCtx.Convey("Then err should be nil.addit should not be nil.", func(convCtx convey.C) {
  19. convCtx.So(err, convey.ShouldBeNil)
  20. })
  21. })
  22. })
  23. }