appInfoLogic_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package test
  2. import (
  3. "git.rtzhtech.cn/iss/public-lib/dto"
  4. "git.rtzhtech.cn/iss/public-lib/logic"
  5. "git.rtzhtech.cn/iss/public-lib/model"
  6. "testing"
  7. )
  8. func TestSaveAppInfo(t *testing.T) {
  9. md := logic.NewAppInfoLogic()
  10. req := new(model.SysApp)
  11. req.Appname = "测试app"
  12. req.Version = "v1.0"
  13. req.Appid = 1
  14. req.Path = "/home/work/xxxx"
  15. err := md.SaveAppInfo(req)
  16. if err != nil {
  17. t.Error(err)
  18. }
  19. }
  20. func TestSaveAppInfoMap(t *testing.T) {
  21. md := logic.NewAppInfoLogic()
  22. req := map[string]any{
  23. "appid": 2,
  24. "appname": "测试app2",
  25. "path": "/home/work/yyy",
  26. "version": "v1.0",
  27. }
  28. err := md.SaveAppInfoMap(req)
  29. if err != nil {
  30. t.Error(err)
  31. }
  32. }
  33. func TestDelAppInfo(t *testing.T) {
  34. md := logic.NewAppInfoLogic()
  35. err := md.DelAppInfo(2)
  36. if err != nil {
  37. t.Error(err)
  38. }
  39. }
  40. func TestGetAppInfo(t *testing.T) {
  41. md := logic.NewAppInfoLogic()
  42. req := new(dto.GetAppInfoRequest)
  43. req.AppName = "测试"
  44. req.Page = 1
  45. req.Limit = 22
  46. list, err := md.GetAppInfo(req)
  47. if err != nil {
  48. t.Error(err)
  49. }
  50. for _, val := range list.List {
  51. t.Log(val)
  52. }
  53. }