test_specific.ps1 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $ErrorActionPreference = "SilentlyContinue"
  2. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  3. # Login
  4. $body = '{"username":"admin","password":"admin123","tenantCode":"T202605253515"}'
  5. $resp = Invoke-WebRequest -Uri 'http://localhost:8006/login' -Method POST -ContentType 'application/json' -Body $body -UseBasicParsing -TimeoutSec 10
  6. $json = $resp.Content | ConvertFrom-Json
  7. $token = $json.token
  8. Write-Output "Token: $($token.Substring(0,20))..."
  9. $headers = @{ 'Authorization' = "Bearer $token"; 'Content-Type' = 'application/json' }
  10. # Test some specific his endpoints that SHOULD be loaded from fs-admin-saas
  11. $tests = @(
  12. '/his/doctor/list', # fs-company own controller -> should be 200
  13. '/his/follow/list', # EXCLUDED in excludeFilters -> should be 404, but company has /his/follow too
  14. '/his/store/list', # from fs-admin-saas, NOT excluded
  15. '/his/user/list', # from fs-admin-saas, NOT excluded
  16. '/his/storeOrder/list', # from fs-admin-saas, NOT excluded
  17. '/course/courseDomainName/list', # from fs-admin-saas, NOT excluded
  18. '/course/userCourseComment/list', # from fs-admin-saas, NOT excluded
  19. '/crm/customer/list', # EXCLUDED com.fs.crm.controller.*
  20. '/live/coupon/list', # EXCLUDED com.fs.live.controller.* BUT live/coupon returned 200 before!
  21. '/fastGpt/fastGptChatMsg/list', # EXCLUDED com.fs.fastGpt.*
  22. '/qw/externalContact/list', # EXCLUDED com.fs.qw.controller.* BUT working!
  23. '/qw/tag/list', # fs-company own /qw/tag
  24. '/company/company/list', # fs-company own
  25. '/company/companyConfig/list', # fs-company own
  26. '/company/easyCall/list', # fs-company own
  27. '/system/user/list', # from fs-admin-saas, routed to 8003
  28. '/system/dept/list' # from fs-admin-saas, routed to 8003
  29. )
  30. Write-Output "=== Testing on fs-company (8006) ==="
  31. foreach ($url in $tests) {
  32. try {
  33. $r = Invoke-WebRequest -Uri "http://localhost:8006$url" -Method POST -Headers $headers -Body '{}' -UseBasicParsing -TimeoutSec 5
  34. $body = $r.Content.Substring(0, [Math]::Min(100, $r.Content.Length))
  35. Write-Output "200 | $url | $body"
  36. } catch {
  37. $err = $_.Exception.Message
  38. if ($err -match '(\d{3})') { $code = $Matches[1] } else { $code = 'ERR' }
  39. Write-Output "$code | $url"
  40. }
  41. }
  42. Write-Output ""
  43. Write-Output "=== Testing on fs-admin (8003) ==="
  44. foreach ($url in $tests) {
  45. try {
  46. $r = Invoke-WebRequest -Uri "http://localhost:8003$url" -Method POST -Headers $headers -Body '{}' -UseBasicParsing -TimeoutSec 5
  47. Write-Output "200 | $url"
  48. } catch {
  49. $err = $_.Exception.Message
  50. if ($err -match '(\d{3})') { $code = $Matches[1] } else { $code = 'ERR' }
  51. Write-Output "$code | $url"
  52. }
  53. }