mysql_test.go 793 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/job/main/figure/model"
  7. )
  8. func TestSaveFigure(t *testing.T) {
  9. once.Do(startService)
  10. f := &model.Figure{
  11. Mid: 761223,
  12. Score: 100,
  13. LawfulScore: d.c.Figure.Lawful,
  14. WideScore: d.c.Figure.Wide,
  15. FriendlyScore: d.c.Figure.Friendly,
  16. BountyScore: d.c.Figure.Bounty,
  17. CreativityScore: d.c.Figure.Creativity,
  18. Ver: 1,
  19. Ctime: time.Now(),
  20. Mtime: time.Now(),
  21. }
  22. if id, err := d.SaveFigure(context.TODO(), f); err != nil {
  23. t.Errorf("figure err (%v)", err)
  24. } else {
  25. t.Logf("id(%d)", id)
  26. }
  27. }
  28. func TestGetFigure(t *testing.T) {
  29. once.Do(startService)
  30. var mid int64 = 7593623
  31. id, _ := d.ExistFigure(context.TODO(), mid)
  32. t.Logf("id:%d", id)
  33. }