mysql_test.go 974 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/passport-encrypt/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDao_PingMySQL(t *testing.T) {
  9. once.Do(startDao)
  10. if err := d.encryptDB.Ping(context.TODO()); err != nil {
  11. t.Errorf("dao.cloudDB.Ping() error(%v)", err)
  12. t.FailNow()
  13. }
  14. }
  15. func TestDao_UpdateAsoAccount(t *testing.T) {
  16. once.Do(startDao)
  17. Convey("update a aso account", t, func() {
  18. account := &model.EncryptAccount{
  19. Mid: 12047569,
  20. UserID: "bili_1710676855",
  21. Uname: "Bili_12047569",
  22. Pwd: "3686c9d96ae6896fe117319ba6c07087",
  23. Salt: "pdMXF856",
  24. Email: "62fe0d616162f56ecab3e12a2de83ea6",
  25. Tel: []byte("bdb27b0300e3984e48e7aea5c672a243"),
  26. CountryID: 1,
  27. MobileVerified: 1,
  28. Isleak: 0,
  29. }
  30. affected, err := d.UpdateAsoAccount(context.TODO(), account)
  31. So(err, ShouldBeNil)
  32. So(affected, ShouldEqual, 1)
  33. })
  34. }