activity_test.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/coupon/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. // go test -test.v -test.run TestAnalysisFile
  9. func TestAnalysisFile(t *testing.T) {
  10. Convey("TestAnalysisFile ", t, func() {
  11. res, total, err := s.AnalysisFile(c, "/data/lv4.csv")
  12. t.Logf("res(%v) total(%d)", res, total)
  13. So(err, ShouldBeNil)
  14. })
  15. }
  16. // go test -test.v -test.run TestTokeni
  17. func TestTokeni(t *testing.T) {
  18. Convey("TestTokeni ", t, func() {
  19. token := s.tokeni(100)
  20. t.Logf("token(%s)", token)
  21. So(token, ShouldNotBeBlank)
  22. })
  23. }
  24. // go test -test.v -test.run TestOutFile
  25. func TestOutFile(t *testing.T) {
  26. Convey("TestOutFile ", t, func() {
  27. err := s.OutFile(context.Background(), []byte("haha"), "/data/test.csv")
  28. So(err, ShouldBeNil)
  29. })
  30. }
  31. // go test -test.v -test.run TestBatchSalary
  32. func TestBatchSalary(t *testing.T) {
  33. Convey("TestbatchSalary ", t, func() {
  34. r, err := s.dao.BatchInfo(c, "allowance_lv41-4")
  35. So(err, ShouldBeNil)
  36. _, err = s.batchSalary(context.Background(), []int64{1, 2, 3}, "127.0.0.1", r)
  37. So(err, ShouldBeNil)
  38. })
  39. }
  40. // go test -test.v -test.run TestActivitySalaryCoupon
  41. func TestActivitySalaryCoupon(t *testing.T) {
  42. Convey("TestActivitySalaryCoupon ", t, func() {
  43. err := s.ActivitySalaryCoupon(c, &model.ArgBatchSalaryCoupon{
  44. FileURL: "/data/1.csv",
  45. Count: 1,
  46. BranchToken: "allowance_lv41-4",
  47. SliceSize: 1000,
  48. })
  49. So(err, ShouldBeNil)
  50. })
  51. }