offer_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package offer
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-wall/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func ctx() context.Context {
  15. return context.Background()
  16. }
  17. func init() {
  18. dir, _ := filepath.Abs("../../cmd/app-wall-test.toml")
  19. flag.Set("conf", dir)
  20. conf.Init()
  21. d = New(conf.Conf)
  22. time.Sleep(time.Second)
  23. }
  24. func TestUpIdfaActive(t *testing.T) {
  25. Convey("UpIdfaActive", t, func() {
  26. _, err := d.UpIdfaActive(ctx(), "", "", time.Now())
  27. So(err, ShouldBeNil)
  28. })
  29. }
  30. func TestCallback(t *testing.T) {
  31. Convey("Callback", t, func() {
  32. _, _, err := d.Callback(ctx(), "", "", time.Now())
  33. So(err, ShouldBeNil)
  34. })
  35. }
  36. func TestRMacCount(t *testing.T) {
  37. Convey("RMacCount", t, func() {
  38. _, err := d.RMacCount(ctx(), "")
  39. So(err, ShouldBeNil)
  40. })
  41. }
  42. func TestExists(t *testing.T) {
  43. Convey("RMacCount", t, func() {
  44. _, err := d.RMacCount(ctx(), "")
  45. So(err, ShouldBeNil)
  46. })
  47. }
  48. func TestInANClick(t *testing.T) {
  49. Convey("InANClick", t, func() {
  50. _, err := d.InANClick(ctx(), "", "", "", "", "", 11, time.Now())
  51. So(err, ShouldBeNil)
  52. })
  53. }
  54. func TestANActive(t *testing.T) {
  55. Convey("ANActive", t, func() {
  56. _, err := d.ANActive(ctx(), "", "", "")
  57. So(err, ShouldBeNil)
  58. })
  59. }
  60. func TestANCallback(t *testing.T) {
  61. Convey("ANCallback", t, func() {
  62. _, _, _, _, err := d.ANCallback(ctx(), "", "", "")
  63. So(err, ShouldBeNil)
  64. })
  65. }