1234567891011121314151617181920212223242526272829303132333435 |
- // Quota-related mock handlers
- // 封装获取配额成功的 mock
- export function mockGetQuotaSuccess() {
- cy.intercept('GET', '/dr/api/v1/pub/quota', (req) => {
- req.reply({
- statusCode: 200,
- body: {
- code: "0x000000",
- data: {
- total: 50,
- available: 50,
- online: true,
- overdue: false
- },
- description: "Success",
- solution: ""
- }
- });
- }).as('getQuotaSuccess');
- }
- // 封装获取配额失败的 mock
- export function mockGetQuotaFail() {
- cy.intercept('GET', '/dr/api/v1/pub/quota', (req) => {
- req.reply({
- statusCode: 200, // 一般还是200,通过 code 区分失败
- body: {
- code: "0x000001",
- description: "Failed to retrieve quota",
- solution: "Please try again later",
- data: {}
- }
- });
- }).as('getQuotaFail');
- }
|