Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Fix for failing Bruno tests #121

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
meta {
name: AppWithDelegableRights_Ok
name: InstDelg_DelgChk_AppWithDelegableRights_Ok
type: http
seq: 1
}
Expand Down Expand Up @@ -43,9 +43,11 @@ script:pre-request {
}

tests {
test("AppsInstanceDelegation DelegationCheck GET AppWithDelegableRights_Ok", function() {
var body = res.getBody();
var data = body.data;
// Should be the same as the .bru request file. Used as prefix in test name which also shows in test result in pipeline.
const requestName = "InstDelg_DelgChk_AppWithDelegableRights_Ok";
const data = res.getBody().data;

test(requestName, function() {
expect(res.status).to.equal(200);
expect(data[0]).to.have.property('rightKey', 'app_ttd_authz-bruno-instancedelegation,task_1:read')
expect(data[0]).to.have.property('status', 'Delegable')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
meta {
name: AppWithoutDelegableRights_BadRequest
name: InstDelg_DelgChk_AppWithoutDelegableRights_OkEmpty
type: http
seq: 2
}
Expand Down Expand Up @@ -43,10 +43,12 @@ script:pre-request {
}

tests {
test("AppsInstanceDelegation DelegationCheck GET AppWithoutDelegableRights_Forbidden", function() {
var body = res.getBody();
expect(res.status).to.equal(400);
expect(body.validationErrors[0].code).to.equal("AM.VLD-00004");
expect(body.validationErrors[0].paths[0]).to.equal("appInstanceDelegationRequest.Resource");
// Should be the same as the .bru request file. Used as prefix in test name which also shows in test result in pipeline.
const requestName = "InstDelg_DelgChk_AppWithoutDelegableRights_OkEmpty";
const body = res.getBody();

test(requestName + "|HttpStatus.OK and Body.Data empty", function() {
expect(res.status).to.equal(200);
assert.isEmpty(body.data, `Expected data in body to be empty.`);
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
meta {
name: MissingToken_NotAuthorized
name: InstDelg_DelgChk_MissingToken_NotAuthorized
type: http
seq: 4
}
Expand All @@ -18,7 +18,7 @@ params:path {
headers {
Accept: application/json
PlatformAccessToken: {{platformAccessToken}}
Ocp-Apim-Subscription-Key: {{apimSubscriptionKey}}
~Ocp-Apim-Subscription-Key: {{apimSubscriptionKey}}
}

script:pre-request {
Expand All @@ -30,8 +30,12 @@ script:pre-request {
}

tests {
test("AppsInstanceDelegation DelegationCheck GET MissingToken_NotAuthorized", function() {
var body = res.getBody();
// Should be the same as the .bru request file. Used as prefix in test name which also shows in test result in pipeline.
const requestName = "InstDelg_DelgChk_MissingToken_NotAuthorized";
const body = res.getBody();

test(requestName, function() {
expect(res.status).to.equal(401);
assert.isNotOk(body, `Expected body to be empty. Actual: ${JSON.stringify(body)}`);
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
meta {
name: PlatformAccessToken_BadRequest
name: InstDelg_DelgChk_PlatformAccessToken_OkEmpty
type: http
seq: 3
}
Expand Down Expand Up @@ -43,10 +43,12 @@ script:pre-request {
}

tests {
test("AppsInstanceDelegation DelegationCheck GET PlatformAccessToken_Forbidden", function() {
var body = res.getBody();
expect(res.status).to.equal(400);
expect(body.validationErrors[0].code).to.equal("AM.VLD-00004");
expect(body.validationErrors[0].paths[0]).to.equal("appInstanceDelegationRequest.Resource");
// Should be the same as the .bru request file. Used as prefix in test name which also shows in test result in pipeline.
const requestName = "InstDelg_DelgChk_PlatformAccessToken_OkEmpty";
const body = res.getBody();

test(requestName + "|HttpStatus.OK and Body.Data empty", function() {
expect(res.status).to.equal(200);
assert.isEmpty(body.data, `Expected data in body to be empty.`);
});
}
Loading