mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
test(cypress): add test for In Memory Cache (#6961)
Co-authored-by: Sumit Kumar <sumit.kumar@Sumit-Kumar-D9GXRYR75W.local> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Kartikeya Hegde <karthikey.hegde@juspay.in>
This commit is contained in:
@ -3369,3 +3369,95 @@ Cypress.Commands.add("incrementalAuth", (globalState, data) => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("createConfigs", (globalState, key, value) => {
|
||||
const base_url = globalState.get("baseUrl");
|
||||
const api_key = globalState.get("adminApiKey");
|
||||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${base_url}/configs/`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
},
|
||||
body: {
|
||||
key: key,
|
||||
value: value,
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.have.property("key").to.equal(key);
|
||||
expect(response.body).to.have.property("value").to.equal(value);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("fetchConfigs", (globalState, key, value) => {
|
||||
const base_url = globalState.get("baseUrl");
|
||||
const api_key = globalState.get("adminApiKey");
|
||||
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `${base_url}/configs/${key}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.have.property("key").to.equal(key);
|
||||
expect(response.body).to.have.property("value").to.equal(value);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("updateConfigs", (globalState, key, value) => {
|
||||
const base_url = globalState.get("baseUrl");
|
||||
const api_key = globalState.get("adminApiKey");
|
||||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${base_url}/configs/${key}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
},
|
||||
body: {
|
||||
key: key,
|
||||
value: value,
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.have.property("key").to.equal(key);
|
||||
expect(response.body).to.have.property("value").to.equal(value);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteConfigs", (globalState, key, value) => {
|
||||
const base_url = globalState.get("baseUrl");
|
||||
const api_key = globalState.get("adminApiKey");
|
||||
|
||||
cy.request({
|
||||
method: "DELETE",
|
||||
url: `${base_url}/configs/${key}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
}).then((response) => {
|
||||
logRequestId(response.headers["x-request-id"]);
|
||||
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body).to.have.property("key").to.equal(key);
|
||||
expect(response.body).to.have.property("value").to.equal(value);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user