mysql_bugly_version_test.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package dao
  2. import (
  3. "strconv"
  4. "testing"
  5. "time"
  6. "go-common/app/admin/ep/marthe/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. var (
  10. tmpIssueNoStr2 = strconv.FormatInt(time.Now().Unix(), 10)
  11. buglyVersion = &model.BuglyVersion{
  12. Version: "Version" + tmpIssueNoStr2,
  13. BuglyProjectID: 1,
  14. Action: model.BuglyVersionActionDisable,
  15. TaskStatus: 1,
  16. UpdateBy: "fengyifeng",
  17. }
  18. )
  19. func Test_Bugly_Version(t *testing.T) {
  20. Convey("test insert bugly Version", t, func() {
  21. err := d.InsertBuglyVersion(buglyVersion)
  22. So(err, ShouldBeNil)
  23. })
  24. Convey("test update bugly Version", t, func() {
  25. buglyVersion.Version = "update" + tmpIssueNoStr2
  26. err := d.UpdateBuglyVersion(buglyVersion)
  27. So(err, ShouldBeNil)
  28. })
  29. Convey("test Query Bugly Version By Version", t, func() {
  30. tmpBuglyVersion, err := d.QueryBuglyVersionByVersion(buglyVersion.Version)
  31. So(err, ShouldBeNil)
  32. So(tmpBuglyVersion.Version, ShouldEqual, buglyVersion.Version)
  33. })
  34. Convey("test Query Bugly Version By Id", t, func() {
  35. tmpBuglyVersion, err := d.QueryBuglyVersion(buglyVersion.ID)
  36. So(err, ShouldBeNil)
  37. So(tmpBuglyVersion.Version, ShouldEqual, buglyVersion.Version)
  38. })
  39. }