api_test.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package pay
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestPayAssReg(t *testing.T) {
  8. convey.Convey("AssReg", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. mid = int64(2089809)
  12. aid = int64(10110826)
  13. bp = int(5)
  14. ip = "127.0.0.1"
  15. )
  16. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  17. err := d.AssReg(c, mid, aid, bp, ip)
  18. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  19. ctx.So(err, convey.ShouldBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestPayAss(t *testing.T) {
  25. convey.Convey("Ass", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. aid = int64(10110826)
  29. ip = "127.0.0.1"
  30. )
  31. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  32. assert, registed, err := d.Ass(c, aid, ip)
  33. ctx.Convey("Then err should be nil.assert,registed should not be nil.", func(ctx convey.C) {
  34. ctx.So(err, convey.ShouldBeNil)
  35. ctx.So(registed, convey.ShouldNotBeNil)
  36. ctx.So(assert, convey.ShouldNotBeNil)
  37. })
  38. })
  39. })
  40. }
  41. func TestPayUserAcceptProtocol(t *testing.T) {
  42. convey.Convey("UserAcceptProtocol", t, func(ctx convey.C) {
  43. var (
  44. c = context.Background()
  45. protocolID = "iamhashstring"
  46. mid = int64(2089809)
  47. )
  48. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  49. accept, err := d.UserAcceptProtocol(c, protocolID, mid)
  50. ctx.Convey("Then err should be nil.accept should not be nil.", func(ctx convey.C) {
  51. ctx.So(err, convey.ShouldBeNil)
  52. ctx.So(accept, convey.ShouldNotBeNil)
  53. })
  54. })
  55. })
  56. }