quota.ts 873 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Quota-related mock handlers
  2. // 封装获取配额成功的 mock
  3. export function mockGetQuotaSuccess() {
  4. cy.intercept('GET', '/dr/api/v1/pub/quota', (req) => {
  5. req.reply({
  6. statusCode: 200,
  7. body: {
  8. code: "0x000000",
  9. data: {
  10. total: 50,
  11. available: 50,
  12. online: true,
  13. overdue: false
  14. },
  15. description: "Success",
  16. solution: ""
  17. }
  18. });
  19. }).as('getQuotaSuccess');
  20. }
  21. // 封装获取配额失败的 mock
  22. export function mockGetQuotaFail() {
  23. cy.intercept('GET', '/dr/api/v1/pub/quota', (req) => {
  24. req.reply({
  25. statusCode: 200, // 一般还是200,通过 code 区分失败
  26. body: {
  27. code: "0x000001",
  28. description: "Failed to retrieve quota",
  29. solution: "Please try again later",
  30. data: {}
  31. }
  32. });
  33. }).as('getQuotaFail');
  34. }