credit_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package notice
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestCreditBan(t *testing.T) {
  8. convey.Convey("Audio", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. oid = int64(0)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. title, link, err := d.Ban(c, oid)
  15. ctx.Convey("Then err should be nil.title,link should not be nil.", func(ctx convey.C) {
  16. if err != nil {
  17. ctx.So(err, convey.ShouldNotBeNil)
  18. } else {
  19. ctx.So(err, convey.ShouldBeNil)
  20. }
  21. ctx.So(link, convey.ShouldNotBeNil)
  22. ctx.So(title, convey.ShouldNotBeNil)
  23. })
  24. })
  25. })
  26. }
  27. func TestNoticeCredit(t *testing.T) {
  28. convey.Convey("Audio", t, func(ctx convey.C) {
  29. var (
  30. c = context.Background()
  31. oid = int64(0)
  32. )
  33. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  34. title, link, err := d.Credit(c, oid)
  35. ctx.Convey("Then err should be nil.title,link should not be nil.", func(ctx convey.C) {
  36. if err != nil {
  37. ctx.So(err, convey.ShouldNotBeNil)
  38. } else {
  39. ctx.So(err, convey.ShouldBeNil)
  40. }
  41. ctx.So(link, convey.ShouldNotBeNil)
  42. ctx.So(title, convey.ShouldNotBeNil)
  43. })
  44. })
  45. })
  46. }
  47. func TestNoticeCreditNotice(t *testing.T) {
  48. convey.Convey("Audio", t, func(ctx convey.C) {
  49. var (
  50. c = context.Background()
  51. oid = int64(0)
  52. )
  53. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  54. title, link, err := d.Notice(c, oid)
  55. ctx.Convey("Then err should be nil.title,link should not be nil.", func(ctx convey.C) {
  56. if err != nil {
  57. ctx.So(err, convey.ShouldNotBeNil)
  58. } else {
  59. ctx.So(err, convey.ShouldBeNil)
  60. }
  61. ctx.So(link, convey.ShouldNotBeNil)
  62. ctx.So(title, convey.ShouldNotBeNil)
  63. })
  64. })
  65. })
  66. }