Skip to content

Commit

Permalink
update test for add, run and delete policy test
Browse files Browse the repository at this point in the history
  • Loading branch information
Celiant committed Jan 30, 2025
1 parent e109ad7 commit ee50735
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,34 @@ context('Import policy test', { tags: ['policies', 'secondPool', 'all'] }, () =>
const SRUsername = Cypress.env('SRUser');
let policyId;

before('Get policy id', () => {

before('Import policy and dry-run it', () => {
Authorization.getAccessToken(SRUsername).then((authorization) => {
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
method: METHOD.POST,
url: API.ApiServer + API.PolicisImportMsg,
body: { messageId: "1707125414.999819805" }, //iRec2
headers: {
authorization,
},
timeout: 180000
timeout: 600000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
response.body.forEach(element => {
if (element.name == "iRec_2") {
policyId = element.id
}
})
})
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
policyId = response.body.at(0).id;
cy.request({
method: METHOD.PUT,
url:
API.ApiServer + API.Policies + policyId + "/" + API.DryRun,
headers: {
authorization,
},
timeout: 180000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
});
});
})
})
});

it('Import a new policy test', () => {
Authorization.getAccessToken(SRUsername).then((authorization) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ context("Delete policy test", { tags: ['policies', 'secondPool', 'all'] }, () =>
})
});

it("Deletes the policy with the provided ID by user - Negative", () => {
it("Deletes the policy test by User - Negative", () => {
Authorization.getAccessToken(UserUsername).then((authorization) => {
cy.request({
method: METHOD.DELETE,
Expand All @@ -53,7 +53,7 @@ context("Delete policy test", { tags: ['policies', 'secondPool', 'all'] }, () =>
});
});

it("Deletes the policy with the provided ID without auth token - Negative", () => {
it("Deletes the policy test without auth token - Negative", () => {
cy.request({
method: METHOD.DELETE,
url: API.ApiServer + API.Policies + policyId + "/" + API.Test + testId,
Expand All @@ -63,7 +63,7 @@ context("Delete policy test", { tags: ['policies', 'secondPool', 'all'] }, () =>
});
});

it("Deletes the policy with the provided ID with invalid auth token - Negative", () => {
it("Deletes the policy test with invalid auth token - Negative", () => {
cy.request({
method: METHOD.DELETE,
url: API.ApiServer + API.Policies + policyId + "/" + API.Test + testId,
Expand All @@ -76,7 +76,7 @@ context("Delete policy test", { tags: ['policies', 'secondPool', 'all'] }, () =>
});
});

it("Deletes the policy with the provided ID with empty auth token - Negative", () => {
it("Deletes the policy test with empty auth token - Negative", () => {
cy.request({
method: METHOD.DELETE,
url: API.ApiServer + API.Policies + policyId + "/" + API.Test + testId,
Expand Down

0 comments on commit ee50735

Please sign in to comment.