-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added automated Bruno tests for AccessList: DelegationCheck and Deleg…
…ation
- Loading branch information
1 parent
cd479f9
commit 3a23f28
Showing
43 changed files
with
197 additions
and
40 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...tDelegation_Dagl_OrgWithPartialAccess.bru → ...tDelegation_Dagl_OrgWithPartialAccess.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: AccessListDelegation_Dagl_OrgWithPartialAccess | ||
type: http | ||
seq: 1 | ||
seq: 4 | ||
} | ||
|
||
post { | ||
|
59 changes: 59 additions & 0 deletions
59
...on/RightsInternal/accesslist-resource/AccessListDelegationCheck_Dagl_OrgPartialAccess.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
meta { | ||
name: AccessListDelegationCheck_Dagl_OrgPartialAccess | ||
type: http | ||
seq: 1 | ||
} | ||
|
||
post { | ||
url: {{baseUrl}}/accessmanagement/api/v1/internal/{{party}}/rights/delegation/delegationcheck | ||
body: json | ||
auth: inherit | ||
} | ||
|
||
body:json { | ||
{ | ||
"resource": [ | ||
{ | ||
"id": "urn:altinn:resource", | ||
"value": "{{resource}}" | ||
} | ||
] | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const testdata = require(`./Testdata/accesslist-delegation/${bru.getEnvVar("tokenEnv")}.json`); | ||
const sharedtestdata = require(`./Testdata/sharedtestdata.json`); | ||
bru.setVar("party", testdata.OrdentligUlasteligStruts.partyid); | ||
bru.setVar("resource", testdata.resource); | ||
|
||
var getTokenParameters = { | ||
auth_tokenType: sharedtestdata.authTokenType.personal, | ||
auth_userId: testdata.OrdentligUlasteligStruts.dagl.userid, | ||
auth_partyId: testdata.OrdentligUlasteligStruts.dagl.partyid, | ||
auth_ssn: testdata.OrdentligUlasteligStruts.dagl.pid | ||
} | ||
|
||
const token = await testTokenGenerator.getToken(getTokenParameters); | ||
bru.setVar("bearerToken", token); | ||
} | ||
|
||
tests { | ||
// 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 = "AccessListDelegationCheck_Dagl_OrgPartialAccess"; | ||
const body = res.getBody(); | ||
|
||
test(requestName + "|HttpStatus.OK", function() { | ||
expect(res.status).to.equal(200); | ||
}); | ||
|
||
test(requestName + "|Read_IsDelegable", function() { | ||
const right = body.find(right => right.rightKey === "devtest_gar_bruno_accesslist_actionfilter:read"); | ||
assert.equal(right.status, "Delegable", `Expected read to be: Delegable`); | ||
}); | ||
|
||
test(requestName + "|Write_IsNotDelegable", function() { | ||
const right = body.find(right => right.rightKey === "devtest_gar_bruno_accesslist_actionfilter:write"); | ||
assert.equal(right.status, "NotDelegable", `Expected write to be; NotDelegable`); | ||
}); | ||
} |
85 changes: 85 additions & 0 deletions
85
...ion/RightsInternal/accesslist-resource/AccessListDelegation_Dagl_OrgPartialAccessRead.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
meta { | ||
name: AccessListDelegation_Dagl_OrgPartialAccessRead | ||
type: http | ||
seq: 2 | ||
} | ||
|
||
post { | ||
url: {{baseUrl}}/accessmanagement/api/v1/internal/{{party}}/rights/delegation/offered | ||
body: json | ||
auth: inherit | ||
} | ||
|
||
body:json { | ||
{ | ||
"to": [ | ||
{ | ||
"id": "urn:altinn:person:identifier-no", | ||
"value": "{{toSsn}}" | ||
}, | ||
{ | ||
"id": "urn:altinn:person:lastname", | ||
"value": "{{toLastName}}" | ||
} | ||
], | ||
"rights": [ | ||
{ | ||
"resource": [ | ||
{ | ||
"id": "urn:altinn:resource", | ||
"value": "{{resource}}" | ||
} | ||
], | ||
"action": "read" | ||
}, | ||
{ | ||
"resource": [ | ||
{ | ||
"id": "urn:altinn:resource", | ||
"value": "{{resource}}" | ||
} | ||
], | ||
"action": "write" | ||
} | ||
] | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const testdata = require(`./Testdata/accesslist-delegation/${bru.getEnvVar("tokenEnv")}.json`); | ||
const sharedtestdata = require(`./Testdata/sharedtestdata.json`); | ||
bru.setVar("party", testdata.SvenskGeniærklertTiger.partyid); | ||
bru.setVar("resource", testdata.resource); | ||
bru.setVar("toSsn", testdata.SvenskGeniærklertTiger.dagl.pid); | ||
bru.setVar("toLastName", "KRYDDERMÅL"); | ||
|
||
var getTokenParameters = { | ||
auth_tokenType: sharedtestdata.authTokenType.personal, | ||
auth_userId: testdata.SvenskGeniærklertTiger.dagl.userid, | ||
auth_partyId: testdata.SvenskGeniærklertTiger.dagl.partyid, | ||
auth_ssn: testdata.SvenskGeniærklertTiger.dagl.pid | ||
} | ||
|
||
const token = await testTokenGenerator.getToken(getTokenParameters); | ||
bru.setVar("bearerToken", token); | ||
} | ||
|
||
tests { | ||
// 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 = "AccessListDelegation_Dagl_OrgPartialAccess"; | ||
const body = res.getBody(); | ||
|
||
test(requestName + "|HttpStatus.OK", function() { | ||
expect(res.status).to.equal(200); | ||
}); | ||
|
||
test(requestName + "|Read_IsDelegable", function() { | ||
const right = body.rightDelegationResults.find(right => right.rightKey === "devtest_gar_bruno_accesslist_actionfilter:read"); | ||
assert.equal(right.status, "Delegated", `Expected read to be: Delegated`); | ||
}); | ||
|
||
test(requestName + "|Write_IsNotDelegable", function() { | ||
const right = body.rightDelegationResults.find(right => right.rightKey === "devtest_gar_bruno_accesslist_actionfilter:write"); | ||
assert.equal(right.status, "NotDelegated", `Expected read to be: NotDelegated`); | ||
}); | ||
} |
2 changes: 1 addition & 1 deletion
2
...atic Test Collection/RightsInternal/non-tilgangsstyrer cannot see offered delegations.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: non-tilgangsstyrer cannot see offered delegations | ||
type: http | ||
seq: 41 | ||
seq: 42 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...tic Test Collection/RightsInternal/non-tilgangsstyrer cannot see received delegations.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: non-tilgangsstyrer cannot see received delegations | ||
type: http | ||
seq: 42 | ||
seq: 43 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...cessManagement/Automatic Test Collection/RightsInternal/o2o cannot delegate to itself.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o cannot delegate to itself | ||
type: http | ||
seq: 36 | ||
seq: 37 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...ccessManagement/Automatic Test Collection/RightsInternal/o2o delegate org2org (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o delegate org2org (again) | ||
type: http | ||
seq: 25 | ||
seq: 26 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...Altinn.AccessManagement/Automatic Test Collection/RightsInternal/o2o delegate org2org.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o delegate org2org | ||
type: http | ||
seq: 21 | ||
seq: 22 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...ement/Automatic Test Collection/RightsInternal/o2o org attempts to delegate to itself.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o org attempts to delegate to itself | ||
type: http | ||
seq: 35 | ||
seq: 36 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...Management/Automatic Test Collection/RightsInternal/o2o org2org delegation successful.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o org2org delegation successful | ||
type: http | ||
seq: 22 | ||
seq: 23 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...tic Test Collection/RightsInternal/o2o receiving org no longer has delegation (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o receiving org no longer has delegation (again) | ||
type: http | ||
seq: 27 | ||
seq: 28 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...t/Automatic Test Collection/RightsInternal/o2o receiving org no longer has delegation.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o receiving org no longer has delegation | ||
type: http | ||
seq: 24 | ||
seq: 25 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...utomatic Test Collection/RightsInternal/o2o receiving org revokes delegation from org.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o receiving org revokes delegation from org | ||
type: http | ||
seq: 23 | ||
seq: 24 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...nt/Automatic Test Collection/RightsInternal/o2o sending org revokes delegation to org.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2o sending org revokes delegation to org | ||
type: http | ||
seq: 26 | ||
seq: 27 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...ssManagement/Automatic Test Collection/RightsInternal/o2p delegate org2person (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p delegate org2person (again) | ||
type: http | ||
seq: 18 | ||
seq: 19 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...inn.AccessManagement/Automatic Test Collection/RightsInternal/o2p delegate org2person.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p delegate org2person | ||
type: http | ||
seq: 14 | ||
seq: 15 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...agement/Automatic Test Collection/RightsInternal/o2p org2person delegation successful.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p org2person delegation successful | ||
type: http | ||
seq: 15 | ||
seq: 16 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...tomatic Test Collection/RightsInternal/o2p receiving person has no delegation (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p receiving person has no delegation (again) | ||
type: http | ||
seq: 20 | ||
seq: 21 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...utomatic Test Collection/RightsInternal/o2p receiving person no longer has delegation.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p receiving person no longer has delegation | ||
type: http | ||
seq: 17 | ||
seq: 18 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...matic Test Collection/RightsInternal/o2p receiving person revokes delegation from org.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p receiving person revokes delegation from org | ||
type: http | ||
seq: 16 | ||
seq: 17 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...Automatic Test Collection/RightsInternal/o2p sending org revokes delegation to person.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: o2p sending org revokes delegation to person | ||
type: http | ||
seq: 19 | ||
seq: 20 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...ssManagement/Automatic Test Collection/RightsInternal/p2o delegate person2org (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o delegate person2org (again) | ||
type: http | ||
seq: 32 | ||
seq: 33 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...inn.AccessManagement/Automatic Test Collection/RightsInternal/p2o delegate person2org.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o delegate person2org | ||
type: http | ||
seq: 28 | ||
seq: 29 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...agement/Automatic Test Collection/RightsInternal/p2o person2org delegation successful.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o person2org delegation successful | ||
type: http | ||
seq: 29 | ||
seq: 30 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...tic Test Collection/RightsInternal/p2o receiving org no longer has delegation (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o receiving org no longer has delegation (again) | ||
type: http | ||
seq: 34 | ||
seq: 35 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...t/Automatic Test Collection/RightsInternal/p2o receiving org no longer has delegation.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o receiving org no longer has delegation | ||
type: http | ||
seq: 31 | ||
seq: 32 | ||
} | ||
|
||
get { | ||
|
2 changes: 1 addition & 1 deletion
2
...matic Test Collection/RightsInternal/p2o receiving org revokes delegation from person.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o receiving org revokes delegation from person | ||
type: http | ||
seq: 30 | ||
seq: 31 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...Automatic Test Collection/RightsInternal/p2o sending person revokes delegation to org.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o sending person revokes delegation to org | ||
type: http | ||
seq: 33 | ||
seq: 34 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...ent/Automatic Test Collection/RightsInternal/p2o testdata cleanup (revoke delegation).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2o testdata cleanup (revoke delegation) | ||
type: http | ||
seq: 4 | ||
seq: 5 | ||
} | ||
|
||
post { | ||
|
2 changes: 1 addition & 1 deletion
2
...anagement/Automatic Test Collection/RightsInternal/p2p delegate person2person (again).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
meta { | ||
name: p2p delegate person2person (again) | ||
type: http | ||
seq: 11 | ||
seq: 12 | ||
} | ||
|
||
post { | ||
|
Oops, something went wrong.