commonPhrases_test.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package test
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledgeclient"
  4. "context"
  5. "github.com/zeromicro/go-zero/zrpc"
  6. "log"
  7. "testing"
  8. "time"
  9. )
  10. func Test_CommonPhrasesAddOrEdit(t *testing.T) {
  11. ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
  12. TestSystem := knowledgeclient.NewKnowledge(zrpc.MustNewClient(c.TestConf))
  13. req := &knowledgeclient.CommonPhrasesAddReq{}
  14. req.AppId = "10000"
  15. req.EntId = 14929
  16. req.Content = "排序看一下"
  17. req.EntUserId = 4315
  18. //req.Id = 32
  19. req.Classify = "排序"
  20. res, err := TestSystem.CommonPhrasesAdd(ctx, req)
  21. log.Println("res ", res)
  22. log.Println("err ", err)
  23. }
  24. func Test_CommonPhrasesInfo(t *testing.T) {
  25. ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
  26. TestSystem := knowledgeclient.NewKnowledge(zrpc.MustNewClient(c.TestConf))
  27. req := &knowledgeclient.CommonPhrasesInfoReq{}
  28. req.Id = 2
  29. res, err := TestSystem.CommonPhrasesInfo(ctx, req)
  30. log.Println("res ", res)
  31. log.Println("err ", err)
  32. }
  33. func Test_CommonPhrasesDel(t *testing.T) {
  34. ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
  35. TestSystem := knowledgeclient.NewKnowledge(zrpc.MustNewClient(c.TestConf))
  36. req := &knowledgeclient.CommonPhrasesInfoReq{}
  37. req.Id = 32
  38. res, err := TestSystem.CommonPhrasesDel(ctx, req)
  39. log.Println("res ", res)
  40. log.Println("err ", err)
  41. }
  42. func Test_CommonPhrasesList(t *testing.T) {
  43. ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
  44. TestSystem := knowledgeclient.NewKnowledge(zrpc.MustNewClient(c.TestConf))
  45. req := &knowledgeclient.CommonPhrasesListReq{}
  46. req.PageIndex = 1
  47. req.EntId = 14929
  48. req.AppId = "10000"
  49. req.PageSize = 10
  50. res, err := TestSystem.CommonPhrasesList(ctx, req)
  51. log.Println("res ", res)
  52. log.Println("err ", err)
  53. }
  54. func Test_CommonPhrasesQuery(t *testing.T) {
  55. ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
  56. TestSystem := knowledgeclient.NewKnowledge(zrpc.MustNewClient(c.TestConf))
  57. req := &knowledgeclient.CommonPhraseQueryReq{}
  58. req.EntId = 14929
  59. req.AppId = "10000"
  60. req.Query = "test"
  61. res, err := TestSystem.CommonPhraseQuery(ctx, req)
  62. log.Println("res ", res)
  63. log.Println("err ", err)
  64. }