mng_v2_test.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func Test_AssetDBConnect(t *testing.T) {
  8. var (
  9. c = context.Background()
  10. host = "172.16.33.205"
  11. port = "3308"
  12. user = "test"
  13. password = "test"
  14. )
  15. Convey("AssetDBConnect", t, WithService(func(s *Service) {
  16. res, err := svr.AssetDBConnect(c, host, port, user, password)
  17. So(err, ShouldBeNil)
  18. So(res, ShouldNotBeNil)
  19. }))
  20. }
  21. func Test_AssetDBAdd(t *testing.T) {
  22. var (
  23. c = context.Background()
  24. name = "bilibili_reply"
  25. description = "评论数据库"
  26. host = "172.16.33.205"
  27. port = "3308"
  28. user = "test"
  29. password = "test"
  30. )
  31. Convey("AssetDBAdd", t, WithService(func(s *Service) {
  32. res, err := svr.AssetDBAdd(c, name, description, host, port, user, password)
  33. So(err, ShouldBeNil)
  34. So(res, ShouldNotBeNil)
  35. }))
  36. }
  37. func Test_AssetTableFields(t *testing.T) {
  38. var (
  39. c = context.Background()
  40. db = "bilibili_reply"
  41. regex = "reply_([0-9]{1,3})"
  42. )
  43. Convey("AssetTableFields", t, WithService(func(s *Service) {
  44. res, _, err := svr.AssetTableFields(c, db, regex)
  45. So(err, ShouldBeNil)
  46. So(res, ShouldNotBeNil)
  47. }))
  48. }
  49. func Test_BusinessUpdate(t *testing.T) {
  50. var (
  51. c = context.Background()
  52. name = "dm"
  53. field = "description"
  54. value = "弹幕11"
  55. )
  56. Convey("BusinessUpdate", t, WithService(func(s *Service) {
  57. res, err := svr.BusinessUpdate(c, name, field, value)
  58. So(err, ShouldBeNil)
  59. So(res, ShouldNotBeNil)
  60. }))
  61. }