cases_test.go 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package tests
  2. import (
  3. "net/http"
  4. "net/url"
  5. "wechat-conf/controllers"
  6. "testing"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestGetCmsCaseList(t *testing.T) {
  10. Convey("获取案场列表", t, func() {
  11. Convey("正常业务", func() {
  12. params := url.Values{}
  13. params.Add("orgid", "1")
  14. result := &controllers.JSONMessage{}
  15. code, _, err := NewRequestMock().Request(http.MethodGet, "/api/guest/MQ/cms/case", params, result)
  16. // http 常规判断, 可以省略
  17. So(code, ShouldEqual, http.StatusOK)
  18. So(err, ShouldBeNil)
  19. // 业务返回判断
  20. So(result.Code, ShouldEqual, http.StatusOK)
  21. So(result.Result, ShouldNotBeEmpty)
  22. })
  23. Convey("机构不传报错", func() {
  24. result := &controllers.JSONMessage{}
  25. code, _, err := NewRequestMock().Request(http.MethodGet, "/api/guest/MQ/cms/case", nil, result)
  26. // http 常规判断, 可以省略
  27. So(code, ShouldEqual, http.StatusOK)
  28. So(err, ShouldBeNil)
  29. // 业务返回判断
  30. So(result.Code, ShouldNotEqual, http.StatusOK)
  31. })
  32. })
  33. }