question_bank_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "testing"
  7. "go-common/app/service/openplatform/anti-fraud/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func init() {
  11. flag.Parse()
  12. if err := conf.Init(); err != nil {
  13. panic(fmt.Errorf("conf.Init() error(%v)", err))
  14. }
  15. d = New(conf.Conf)
  16. }
  17. func TestGetQusBankListByIds(t *testing.T) {
  18. Convey("TestGetQusBankListByIds: ", t, func() {
  19. testIds := []int64{1527233672941, 2, 3}
  20. res, err := d.GetQusBankListByIds(context.TODO(), testIds)
  21. So(err, ShouldBeNil)
  22. So(res, ShouldNotBeNil)
  23. })
  24. }
  25. func TestBankSearch(t *testing.T) {
  26. Convey("TestBankSearch: ", t, func() {
  27. res, err := d.BankSearch(context.TODO(), "name")
  28. So(err, ShouldBeNil)
  29. So(res, ShouldNotBeNil)
  30. })
  31. }
  32. func TestGetQusBankCount(t *testing.T) {
  33. Convey("GetQusBankCount: ", t, func() {
  34. res, err := d.GetQusBankCount(context.TODO(), "wlt")
  35. So(err, ShouldBeNil)
  36. So(res, ShouldBeGreaterThanOrEqualTo, 0)
  37. })
  38. }
  39. func TestUpdateQsBankCnt(t *testing.T) {
  40. Convey("GetQusBankCount: ", t, func() {
  41. res, err := d.UpdateQsBankCnt(context.TODO(), 1527233672941)
  42. So(err, ShouldBeNil)
  43. So(res, ShouldBeGreaterThanOrEqualTo, 0)
  44. })
  45. }