http_test.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoPayRechargeShell(t *testing.T) {
  8. convey.Convey("PayRechargeShell", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. dataJSON = ""
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. err := d.PayRechargeShell(c, dataJSON)
  15. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaoPayCheckRefundOrder(t *testing.T) {
  22. convey.Convey("PayCheckRefundOrder", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. dataJSON = `{"customerId":"10017","sign":"072dfe62a270c7c44f619244962737a6","signType":"MD5","txIds":"3059753508505497600"}`
  26. )
  27. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  28. _, err := d.PayCheckRefundOrder(c, dataJSON)
  29. ctx.Convey("Then err should be nil.orders should not be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldBeNil)
  31. // ctx.So(orders, convey.ShouldNotBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestDaoPayCheckOrder(t *testing.T) {
  37. convey.Convey("PayCheckOrder", t, func(ctx convey.C) {
  38. var (
  39. c = context.Background()
  40. dataJSON = `{"customerId":"10017","sign":"072dfe62a270c7c44f619244962737a6","signType":"MD5","txIds":"3059753508505497600"}`
  41. )
  42. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  43. _, err := d.PayCheckOrder(c, dataJSON)
  44. ctx.Convey("Then err should be nil.orders should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. // ctx.So(orders, convey.ShouldNotBeNil)
  47. })
  48. })
  49. })
  50. }
  51. func TestDaopaySend(t *testing.T) {
  52. convey.Convey("paySend", t, func(ctx convey.C) {
  53. var (
  54. c = context.Background()
  55. url = ""
  56. jsonData = ""
  57. respData = interface{}(0)
  58. )
  59. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  60. err := d.paySend(c, url, jsonData, respData)
  61. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  62. ctx.So(err, convey.ShouldNotBeNil)
  63. })
  64. })
  65. })
  66. }