Skip to content

Commit

Permalink
Cleanup of Bruno test collection
Browse files Browse the repository at this point in the history
#1204
- Request folders split into:
-- local (git ignored
-- shared (prev: Manual Test Collection)
-- test (prev: Autmatic Test Collection)
- Removed whitespaces and øæå from path and request filenames
- Added support for PlatformToken and PlatformAccessToken to token generator
- Added testdata scenario folder support
  • Loading branch information
Jon Kjetil Øye committed Nov 15, 2024
1 parent e896925 commit f9e4fe3
Show file tree
Hide file tree
Showing 43 changed files with 846 additions and 586 deletions.
1 change: 1 addition & 0 deletions test/Bruno/Altinn.Authorization/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Bruno
.env
local

This file was deleted.

15 changes: 14 additions & 1 deletion test/Bruno/Altinn.Authorization/TestTokenGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.getToken = async function (getTokenParameters) {
const tokenParty = getTokenParameters.auth_partyId;
const tokenPid = getTokenParameters.auth_ssn;

tokenUrl = `${tokenBaseUrl}/api/Get${tokenType}Token?env=${tokenEnv}&scopes=${tokenScopes}&pid=${tokenPid}&userid=${tokenUser}&partyid=${tokenParty}&authLvl=3&ttl=3000`;
tokenUrl = `${tokenBaseUrl}/api/Get${tokenType}Token?env=${tokenEnv}&scopes=${tokenScopes}&pid=${tokenPid}&userid=${tokenUser}&partyid=${tokenParty}&authLvl=3&ttl=30`;
}

else if (tokenType == "Enterprise") {
Expand All @@ -38,6 +38,19 @@ exports.getToken = async function (getTokenParameters) {
tokenUrl = `${tokenBaseUrl}/api/Get${tokenType}Token?env=${tokenEnv}&scopes=${tokenScopes}&orgNo=${tokenOrgNo}&userId=${tokenUser}&partyId=${tokenParty}&userName=${tokenUserName}&ttl=30`;
}

else if (tokenType == "PlatformAccessToken") {
const tokenOrg = getTokenParameters.auth_org;
const tokenApp = getTokenParameters.auth_app;

tokenUrl = `${tokenBaseUrl}/api/Get${tokenType}Token?env=${tokenEnv}&org=${tokenOrg}&app=${tokenApp}&ttl=30`;
}

else if (tokenType == "PlatformToken") {
const tokenApp = getTokenParameters.auth_app;

tokenUrl = `${tokenBaseUrl}/api/Get${tokenType}?env=${tokenEnv}&app=${tokenApp}&ttl=30`;
}

const response = await axios.get(tokenUrl, {
headers: { Authorization }
});
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions test/Bruno/Altinn.Authorization/collection.bru
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ script:post-response {

docs {
Dokumentasjon havner i collection.bru filen i rotmappa.

# Støtter markdown
Ja, det gjør det!

## Undertittel
Her er en *undertittel*.

### under-undertittel
Her er en **under-undertittel**.

### Bullet points
* bullet point 1
* bullet point 2
- bullet point 3
- bullet point 4

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
meta {
name: devtest_gar_rrr_accesslist
type: http
seq: 1
}

post {
url: {{baseUrl}}/authorization/api/v1/accesslist/accessmanagement/authorization
body: json
auth: inherit
}

headers {
Content-Type: application/json
Ocp-Apim-Subscription-Key: {{apimSubscriptionKey}}
}

body:json {
{
"subject": {
"type": "urn:altinn:organization:identifier-no",
"value": "910459880"
},
"resource": {
"type": "urn:altinn:resource",
"value": "devtest_gar_rrr_accesslist"
},
"action": {
"type": "urn:oasis:names:tc:xacml:1.0:action:action-id",
"value": "whatever"
}
}
}

script:pre-request {
const sharedtestdata = require(`./Testdata/shared.json`);

var getTokenParameters = {
auth_tokenType: sharedtestdata.authTokenType.enterprise,
auth_scopes: sharedtestdata.auth_scopes.authorize,
auth_org: sharedtestdata.serviceOwners.ttd.org,
auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno,
}

const token = await testTokenGenerator.getToken(getTokenParameters);
bru.setVar("bearerToken", token);
}
Loading

0 comments on commit f9e4fe3

Please sign in to comment.