mysql_tapd_bug_template_test.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. tmp5 = strconv.FormatInt(time.Now().Unix(), 10)
  11. tapdBugTemplate = &model.TapdBugTemplate{
  12. WorkspaceID: tmp5,
  13. IssueFilterSQL: "SELECT * FROM bugly_issues WHERE issue_no = '265'",
  14. SeverityKey: "SeverityKey" + tmp5,
  15. UpdateBy: "fengyifeng",
  16. TapdProperty: model.TapdProperty{
  17. Title: "Title" + tmp5,
  18. Description: "Description" + tmp5,
  19. CurrentOwner: "CurrentOwner" + tmp5,
  20. Platform: "Platform" + tmp5,
  21. Module: "Module" + tmp5,
  22. IterationID: "IterationID" + tmp5,
  23. ReleaseID: "ReleaseID" + tmp5,
  24. Priority: "Priority" + tmp5,
  25. Severity: "Severity" + tmp5,
  26. Source: "Source" + tmp5,
  27. CustomFieldFour: "CustomFieldFour" + tmp5,
  28. BugType: "BugType" + tmp5,
  29. OriginPhase: "OriginPhase" + tmp5,
  30. CustomFieldThree: "CustomFieldThree" + tmp5,
  31. Reporter: "Reporter" + tmp5,
  32. Status: "Status" + tmp5,
  33. },
  34. }
  35. queryTapdBugTemplateRequest = &model.QueryTapdBugTemplateRequest{
  36. Pagination: model.Pagination{
  37. PageSize: 10,
  38. PageNum: 1,
  39. },
  40. }
  41. )
  42. func Test_Tapd_bug_template(t *testing.T) {
  43. Convey("test Insert Tapd Bug Template", t, func() {
  44. err := d.InsertTapdBugTemplate(tapdBugTemplate)
  45. So(err, ShouldBeNil)
  46. })
  47. Convey("test Update Tapd Bug Template", t, func() {
  48. tapdBugTemplate.UpdateBy = "xuneng"
  49. err := d.UpdateTapdBugTemplate(tapdBugTemplate)
  50. So(err, ShouldBeNil)
  51. })
  52. Convey("test Query Tapd Bug Template", t, func() {
  53. tmpTapdBugTemplate, err := d.QueryTapdBugTemplate(tapdBugTemplate.ID)
  54. So(err, ShouldBeNil)
  55. So(tmpTapdBugTemplate.ID, ShouldEqual, tapdBugTemplate.ID)
  56. })
  57. Convey("test Find Tapd Bug Templates", t, func() {
  58. total, tapdBugTemplates, err := d.FindTapdBugTemplates(queryTapdBugTemplateRequest)
  59. So(err, ShouldBeNil)
  60. So(total, ShouldBeGreaterThan, 0)
  61. So(len(tapdBugTemplates), ShouldBeGreaterThan, 0)
  62. })
  63. }