From 1b11da7c1e0820d0351096683ceefa33e89fbc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Kjetil=20=C3=98ye?= Date: Fri, 22 Nov 2024 20:53:02 +0100 Subject: [PATCH 1/2] Added Bruno tests for AuthorizedParties API Endpoints for Instance Delegation Scenarios #890 --- .../InstDelgParties_AsAccMngr_ToOrg_Dagl.bru | 75 ++++++++++++ ...elgParties_AsAccMngr_ToOrg_Dagl_InclA2.bru | 75 ++++++++++++ ...nstDelgParties_AsAccMngr_ToPerson_Self.bru | 78 ++++++++++++ ...Parties_AsAccMngr_ToPerson_Self_InclA2.bru | 78 ++++++++++++ ...DelgParties_AsAccMngr_ToPerson_SubOnly.bru | 61 ++++++++++ ...ties_AsAccMngr_ToPerson_SubOnly_InclA2.bru | 61 ++++++++++ ...InstDelgParties_AsAuthnUser_ToOrg_Dagl.bru | 74 ++++++++++++ ...gParties_AsAuthnUser_ToOrg_Dagl_InclA2.bru | 74 ++++++++++++ .../InstDelgParties_AsAuthnUser_ToPerson.bru | 77 ++++++++++++ ...elgParties_AsAuthnUser_ToPerson_InclA2.bru | 77 ++++++++++++ ...lgParties_AsAuthnUser_ToPerson_SubOnly.bru | 60 ++++++++++ ...ies_AsAuthnUser_ToPerson_SubOnlyInclA2.bru | 60 ++++++++++ .../InstDelgParties_AsResOwner_ToOrg.bru | 83 +++++++++++++ .../InstDelgParties_AsResOwner_ToOrg_Dagl.bru | 83 +++++++++++++ ...lgParties_AsResOwner_ToOrg_Dagl_InclA2.bru | 83 +++++++++++++ ...nstDelgParties_AsResOwner_ToOrg_InclA2.bru | 83 +++++++++++++ .../InstDelgParties_AsResOwner_ToPerson.bru | 86 +++++++++++++ ...DelgParties_AsResOwner_ToPerson_InclA2.bru | 86 +++++++++++++ ...elgParties_AsResOwner_ToPerson_SubOnly.bru | 69 +++++++++++ ...ies_AsResOwner_ToPerson_SubOnly_InclA2.bru | 69 +++++++++++ .../at22.json | 113 ++++++++++++++++++ .../tt02.json | 113 ++++++++++++++++++ 22 files changed, 1718 insertions(+) create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnly.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnlyInclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly_InclA2.bru create mode 100644 test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/at22.json create mode 100644 test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/tt02.json diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl.bru new file mode 100644 index 00000000..b227a989 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl.bru @@ -0,0 +1,75 @@ +meta { + name: InstDelgParties_AsAccMngr_ToOrg_Dagl + type: http + seq: 5 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/{{party}}/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.organizations.legitimJusterbarTiger.dagl.personId, + auth_userId: testdata.organizations.legitimJusterbarTiger.dagl.userId, + auth_partyId: testdata.organizations.legitimJusterbarTiger.dagl.partyId + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + bru.setVar("party", testdata.organizations.legitimJusterbarTiger.partyId); +} + +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 = "InstDelgParties_AsAccMngr_ToOrg_Dagl"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl_InclA2.bru new file mode 100644 index 00000000..4d645ce4 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToOrg_Dagl_InclA2.bru @@ -0,0 +1,75 @@ +meta { + name: InstDelgParties_AsAccMngr_ToOrg_Dagl_InclA2 + type: http + seq: 6 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/{{party}}/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.organizations.legitimJusterbarTiger.dagl.personId, + auth_userId: testdata.organizations.legitimJusterbarTiger.dagl.userId, + auth_partyId: testdata.organizations.legitimJusterbarTiger.dagl.partyId + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + bru.setVar("party", testdata.organizations.legitimJusterbarTiger.partyId); +} + +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 = "InstDelgParties_AsAccMngr_ToOrg_Dagl_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self.bru new file mode 100644 index 00000000..8ca7e73d --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self.bru @@ -0,0 +1,78 @@ +meta { + name: InstDelgParties_AsAccMngr_ToPerson_Self + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/{{party}}/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.hakkeDyr.personId, + auth_userId: testdata.persons.hakkeDyr.userId, + auth_partyId: testdata.persons.hakkeDyr.partyId + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + bru.setVar("party", testdata.persons.hakkeDyr.partyId); +} + +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 = "InstDelgParties_AsAccMngr_ToPerson_Self"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_P2P_PersonDelegatedFrom", function() { + const person = body.find(party => party.partyUuid === testdata.instances.p2p.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation = person.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.p2p.instanceId); + assert.isOk(personDelegation, `InstanceId ${testdata.instances.p2p.instanceId} not found in AuthorizedInstances on Person having delegated the instance`); + }); + + test(requestName + "|Contains_Main2P_MainUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.partyUuid === testdata.instances.main2p.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.legitimJusterbarTiger.organizationNumber} to have Subunit ${testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.organizationNumber}`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_Sub2P_SubUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from); + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.sub2p.instanceId); + assert.isOk(subunitDelegation, `InstanceId ${testdata.instances.sub2p.instanceId} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self_InclA2.bru new file mode 100644 index 00000000..25fb9919 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_Self_InclA2.bru @@ -0,0 +1,78 @@ +meta { + name: InstDelgParties_AsAccMngr_ToPerson_Self_InclA2 + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/{{party}}/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.hakkeDyr.personId, + auth_userId: testdata.persons.hakkeDyr.userId, + auth_partyId: testdata.persons.hakkeDyr.partyId + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + bru.setVar("party", testdata.persons.hakkeDyr.partyId); +} + +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 = "InstDelgParties_AsAccMngr_ToPerson_Self_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_P2P_PersonDelegatedFrom", function() { + const person = body.find(party => party.partyUuid === testdata.instances.p2p.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation = person.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.p2p.instanceId); + assert.isOk(personDelegation, `InstanceId ${testdata.instances.p2p.instanceId} not found in AuthorizedInstances on Person having delegated the instance`); + }); + + test(requestName + "|Contains_Main2P_MainUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.partyUuid === testdata.instances.main2p.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.legitimJusterbarTiger.organizationNumber} to have Subunit ${testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.organizationNumber}`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_Sub2P_SubUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from); + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.sub2p.instanceId); + assert.isOk(subunitDelegation, `InstanceId ${testdata.instances.sub2p.instanceId} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly.bru new file mode 100644 index 00000000..99d54108 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly.bru @@ -0,0 +1,61 @@ +meta { + name: InstDelgParties_AsAccMngr_ToPerson_SubOnly + type: http + seq: 3 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/{{party}}/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.spesifikkSmaragd.personId, + auth_userId: testdata.persons.spesifikkSmaragd.userId, + auth_partyId: testdata.persons.spesifikkSmaragd.partyId + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + bru.setVar("party", testdata.persons.spesifikkSmaragd.partyId); +} + +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 = "InstDelgParties_AsAccMngr_ToPerson_SubOnly"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_SubOnly2P_MainUnitOnlyHierarchy_SubunitWithInstanceIds", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + assert.isOk(mainUnit.onlyHierarchyElementWithNoAccess, `Expected mainUnit.onlyHierarchyElementWithNoAccess to be true. Recipient should only have Subunit access.`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from); + + const subunitInstanceDelegation_1 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_1); + assert.isOk(subunitInstanceDelegation_1, `InstanceId ${testdata.instances.subonly2p.instanceId_1} not found in AuthorizedInstances on Subunit having delegated the instance`); + + const subunitInstanceDelegation_2 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_2); + assert.isOk(subunitInstanceDelegation_2, `InstanceId ${testdata.instances.subonly2p.instanceId_2} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly_InclA2.bru new file mode 100644 index 00000000..974b27c7 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAccessManager/InstDelgParties_AsAccMngr_ToPerson_SubOnly_InclA2.bru @@ -0,0 +1,61 @@ +meta { + name: InstDelgParties_AsAccMngr_ToPerson_SubOnly_InclA2 + type: http + seq: 4 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/{{party}}/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.spesifikkSmaragd.personId, + auth_userId: testdata.persons.spesifikkSmaragd.userId, + auth_partyId: testdata.persons.spesifikkSmaragd.partyId + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + bru.setVar("party", testdata.persons.spesifikkSmaragd.partyId); +} + +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 = "InstDelgParties_AsAccMngr_ToPerson_SubOnly_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_SubOnly2P_MainUnitOnlyHierarchy_SubunitWithInstanceIds", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + assert.isOk(mainUnit.onlyHierarchyElementWithNoAccess, `Expected mainUnit.onlyHierarchyElementWithNoAccess to be true. Recipient should only have Subunit access.`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from); + + const subunitInstanceDelegation_1 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_1); + assert.isOk(subunitInstanceDelegation_1, `InstanceId ${testdata.instances.subonly2p.instanceId_1} not found in AuthorizedInstances on Subunit having delegated the instance`); + + const subunitInstanceDelegation_2 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_2); + assert.isOk(subunitInstanceDelegation_2, `InstanceId ${testdata.instances.subonly2p.instanceId_2} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl.bru new file mode 100644 index 00000000..a9eacc95 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl.bru @@ -0,0 +1,74 @@ +meta { + name: InstDelgParties_AsAuthnUser_ToOrg_Dagl + type: http + seq: 5 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.organizations.legitimJusterbarTiger.dagl.personId, + auth_userId: testdata.organizations.legitimJusterbarTiger.dagl.userId, + auth_partyId: testdata.organizations.legitimJusterbarTiger.dagl.partyId + } + + 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 = "InstDelgParties_AsAuthnUser_ToOrg_Dagl"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl_InclA2.bru new file mode 100644 index 00000000..db410c39 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToOrg_Dagl_InclA2.bru @@ -0,0 +1,74 @@ +meta { + name: InstDelgParties_AsAuthnUser_ToOrg_Dagl_InclA2 + type: http + seq: 6 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.organizations.legitimJusterbarTiger.dagl.personId, + auth_userId: testdata.organizations.legitimJusterbarTiger.dagl.userId, + auth_partyId: testdata.organizations.legitimJusterbarTiger.dagl.partyId + } + + 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 = "InstDelgParties_AsAuthnUser_ToOrg_Dagl_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson.bru new file mode 100644 index 00000000..910d6b6c --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson.bru @@ -0,0 +1,77 @@ +meta { + name: InstDelgParties_AsAuthnUser_ToPerson + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.hakkeDyr.personId, + auth_userId: testdata.persons.hakkeDyr.userId, + auth_partyId: testdata.persons.hakkeDyr.partyId + } + + 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 = "InstDelgParties_AsAuthnUser_ToPerson"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_P2P_PersonDelegatedFrom", function() { + const person = body.find(party => party.partyUuid === testdata.instances.p2p.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation = person.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.p2p.instanceId); + assert.isOk(personDelegation, `InstanceId ${testdata.instances.p2p.instanceId} not found in AuthorizedInstances on Person having delegated the instance`); + }); + + test(requestName + "|Contains_Main2P_MainUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.partyUuid === testdata.instances.main2p.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.legitimJusterbarTiger.organizationNumber} to have Subunit ${testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.organizationNumber}`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_Sub2P_SubUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from); + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.sub2p.instanceId); + assert.isOk(subunitDelegation, `InstanceId ${testdata.instances.sub2p.instanceId} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_InclA2.bru new file mode 100644 index 00000000..58cac01a --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_InclA2.bru @@ -0,0 +1,77 @@ +meta { + name: InstDelgParties_AsAuthnUser_ToPerson_InclA2 + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.hakkeDyr.personId, + auth_userId: testdata.persons.hakkeDyr.userId, + auth_partyId: testdata.persons.hakkeDyr.partyId + } + + 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 = "InstDelgParties_AsAuthnUser_ToPerson_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_P2P_PersonDelegatedFrom", function() { + const person = body.find(party => party.partyUuid === testdata.instances.p2p.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation = person.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.p2p.instanceId); + assert.isOk(personDelegation, `InstanceId ${testdata.instances.p2p.instanceId} not found in AuthorizedInstances on Person having delegated the instance`); + }); + + test(requestName + "|Contains_Main2P_MainUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.partyUuid === testdata.instances.main2p.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.legitimJusterbarTiger.organizationNumber} to have Subunit ${testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.organizationNumber}`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_Sub2P_SubUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from); + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.sub2p.instanceId); + assert.isOk(subunitDelegation, `InstanceId ${testdata.instances.sub2p.instanceId} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnly.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnly.bru new file mode 100644 index 00000000..e719f374 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnly.bru @@ -0,0 +1,60 @@ +meta { + name: InstDelgParties_AsAuthnUser_ToPerson_SubOnly + type: http + seq: 3 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.spesifikkSmaragd.personId, + auth_userId: testdata.persons.spesifikkSmaragd.userId, + auth_partyId: testdata.persons.spesifikkSmaragd.partyId + } + + 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 = "InstDelgParties_AsAuthnUser_ToPerson_SubOnly"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_SubOnly2P_MainUnitOnlyHierarchy_SubunitWithInstanceIds", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + assert.isOk(mainUnit.onlyHierarchyElementWithNoAccess, `Expected mainUnit.onlyHierarchyElementWithNoAccess to be true. Recipient should only have Subunit access.`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from); + + const subunitInstanceDelegation_1 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_1); + assert.isOk(subunitInstanceDelegation_1, `InstanceId ${testdata.instances.subonly2p.instanceId_1} not found in AuthorizedInstances on Subunit having delegated the instance`); + + const subunitInstanceDelegation_2 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_2); + assert.isOk(subunitInstanceDelegation_2, `InstanceId ${testdata.instances.subonly2p.instanceId_2} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnlyInclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnlyInclA2.bru new file mode 100644 index 00000000..aa7a08ec --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsAuthenticatedUser/InstDelgParties_AsAuthnUser_ToPerson_SubOnlyInclA2.bru @@ -0,0 +1,60 @@ +meta { + name: InstDelgParties_AsAuthnUser_ToPerson_SubOnlyInclA2 + type: http + seq: 4 +} + +get { + url: {{baseUrl}}/accessmanagement/api/v1/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.personal, + auth_ssn: testdata.persons.spesifikkSmaragd.personId, + auth_userId: testdata.persons.spesifikkSmaragd.userId, + auth_partyId: testdata.persons.spesifikkSmaragd.partyId + } + + 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 = "InstDelgParties_AsAuthnUser_ToPerson_SubOnlyInclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_SubOnly2P_MainUnitOnlyHierarchy_SubunitWithInstanceIds", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + assert.isOk(mainUnit.onlyHierarchyElementWithNoAccess, `Expected mainUnit.onlyHierarchyElementWithNoAccess to be true. Recipient should only have Subunit access.`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from); + + const subunitInstanceDelegation_1 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_1); + assert.isOk(subunitInstanceDelegation_1, `InstanceId ${testdata.instances.subonly2p.instanceId_1} not found in AuthorizedInstances on Subunit having delegated the instance`); + + const subunitInstanceDelegation_2 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_2); + assert.isOk(subunitInstanceDelegation_2, `InstanceId ${testdata.instances.subonly2p.instanceId_2} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg.bru new file mode 100644 index 00000000..91ec1f22 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg.bru @@ -0,0 +1,83 @@ +meta { + name: InstDelgParties_AsResOwner_ToOrg + type: http + seq: 5 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:organization:identifier-no", + "value": "{{toOrganizationId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toOrganizationId", testdata.organizations.legitimJusterbarTiger.organizationNumber); +} + +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 = "InstDelgParties_AsResOwner_ToOrg"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl.bru new file mode 100644 index 00000000..d54348b0 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl.bru @@ -0,0 +1,83 @@ +meta { + name: InstDelgParties_AsResOwner_ToOrg_Dagl + type: http + seq: 7 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:person:identifier-no", + "value": "{{toPersonId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toPersonId", testdata.organizations.legitimJusterbarTiger.dagl.personId); +} + +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 = "InstDelgParties_AsResOwner_ToOrg_Dagl"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl_InclA2.bru new file mode 100644 index 00000000..ae92d76b --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_Dagl_InclA2.bru @@ -0,0 +1,83 @@ +meta { + name: InstDelgParties_AsResOwner_ToOrg_Dagl_InclA2 + type: http + seq: 8 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:person:identifier-no", + "value": "{{toPersonId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toPersonId", testdata.organizations.legitimJusterbarTiger.dagl.personId); +} + +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 = "InstDelgParties_AsResOwner_ToOrg_Dagl_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_InclA2.bru new file mode 100644 index 00000000..ab979096 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToOrg_InclA2.bru @@ -0,0 +1,83 @@ +meta { + name: InstDelgParties_AsResOwner_ToOrg_InclA2 + type: http + seq: 6 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:organization:identifier-no", + "value": "{{toOrganizationId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toOrganizationId", testdata.organizations.legitimJusterbarTiger.organizationNumber); +} + +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 = "InstDelgParties_AsResOwner_ToOrg_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_O2O_MainUnitDelegatedFrom", function() { + const instanceId = testdata.instances.o2o.instanceId; + const mainUnit = body.find(party => party.partyUuid === testdata.instances.o2o.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.mobilBeskjedenTiger.organizationNumber} to have Subunit ${testdata.organizations.mobilBeskjedenTiger.subunits.mobilBeskjedenTiger.organizationNumber}. Maybe this bug has been fixed: https://github.com/Altinn/altinn-access-management/issues/873 ? If so update this test to not expect to find subunit.`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_P2O_PersonDelegatedFrom", function() { + const instanceId_1 = testdata.instances.p2o.instanceId_1; + const instanceId_2 = testdata.instances.p2o.instanceId_2; + const person = body.find(party => party.partyUuid === testdata.instances.p2o.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation_1 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_1); + assert.isOk(personDelegation_1, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + + const personDelegation_2 = person.authorizedInstances.find(delegation => delegation.instanceId === instanceId_2); + assert.isOk(personDelegation_2, `InstanceId ${instanceId_1} not found in AuthorizedInstances on Person having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson.bru new file mode 100644 index 00000000..360ed071 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson.bru @@ -0,0 +1,86 @@ +meta { + name: InstDelgParties_AsResOwner_ToPerson + type: http + seq: 1 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:person:identifier-no", + "value": "{{toPersonId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toPersonId", testdata.persons.hakkeDyr.personId); +} + +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 = "InstDelgParties_AsResOwner_ToPerson"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_P2P_PersonDelegatedFrom", function() { + const person = body.find(party => party.partyUuid === testdata.instances.p2p.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation = person.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.p2p.instanceId); + assert.isOk(personDelegation, `InstanceId ${testdata.instances.p2p.instanceId} not found in AuthorizedInstances on Person having delegated the instance`); + }); + + test(requestName + "|Contains_Main2P_MainUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.partyUuid === testdata.instances.main2p.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.legitimJusterbarTiger.organizationNumber} to have Subunit ${testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.organizationNumber}`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_Sub2P_SubUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from); + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.sub2p.instanceId); + assert.isOk(subunitDelegation, `InstanceId ${testdata.instances.sub2p.instanceId} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_InclA2.bru new file mode 100644 index 00000000..877d50a1 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_InclA2.bru @@ -0,0 +1,86 @@ +meta { + name: InstDelgParties_AsResOwner_ToPerson_InclA2 + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:person:identifier-no", + "value": "{{toPersonId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toPersonId", testdata.persons.hakkeDyr.personId); +} + +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 = "InstDelgParties_AsResOwner_ToPerson_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_P2P_PersonDelegatedFrom", function() { + const person = body.find(party => party.partyUuid === testdata.instances.p2p.from); + assert.isOk(person, `Person having delegated instance access was not found in AuthorizedParties for recipient`); + + const personDelegation = person.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.p2p.instanceId); + assert.isOk(personDelegation, `InstanceId ${testdata.instances.p2p.instanceId} not found in AuthorizedInstances on Person having delegated the instance`); + }); + + test(requestName + "|Contains_Main2P_MainUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.partyUuid === testdata.instances.main2p.from); + assert.isOk(mainUnit, `MainUnit having delegated instance access was not found in AuthorizedParties for recipient`); + + const mainUnitDelegation = mainUnit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isOk(mainUnitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} not found in AuthorizedInstances on MainUnit having delegated the instance`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.partyUuid); + assert.isOk(subunit, `Expected MainUnit ${testdata.organizations.legitimJusterbarTiger.organizationNumber} to have Subunit ${testdata.organizations.legitimJusterbarTiger.subunits.legitimJusterbarTiger.organizationNumber}`); + + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.main2p.instanceId); + assert.isNotOk(subunitDelegation, `InstanceId ${testdata.instances.main2p.instanceId} should not be found in AuthorizedInstances on Subunit`); + }); + + test(requestName + "|Contains_Sub2P_SubUnitDelegatedFrom", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.sub2p.from); + const subunitDelegation = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.sub2p.instanceId); + assert.isOk(subunitDelegation, `InstanceId ${testdata.instances.sub2p.instanceId} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly.bru new file mode 100644 index 00000000..f81ca2c0 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly.bru @@ -0,0 +1,69 @@ +meta { + name: InstDelgParties_AsResOwner_ToPerson_SubOnly + type: http + seq: 3 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=false + body: json + auth: inherit +} + +params:query { + includeAltinn2: false +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:person:identifier-no", + "value": "{{toPersonId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toPersonId", testdata.persons.spesifikkSmaragd.personId); +} + +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 = "InstDelgParties_AsResOwner_ToPerson_SubOnly"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_SubOnly2P_MainUnitOnlyHierarchy_SubunitWithInstanceIds", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + assert.isOk(mainUnit.onlyHierarchyElementWithNoAccess, `Expected mainUnit.onlyHierarchyElementWithNoAccess to be true. Recipient should only have Subunit access.`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from); + + const subunitInstanceDelegation_1 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_1); + assert.isOk(subunitInstanceDelegation_1, `InstanceId ${testdata.instances.subonly2p.instanceId_1} not found in AuthorizedInstances on Subunit having delegated the instance`); + + const subunitInstanceDelegation_2 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_2); + assert.isOk(subunitInstanceDelegation_2, `InstanceId ${testdata.instances.subonly2p.instanceId_2} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly_InclA2.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly_InclA2.bru new file mode 100644 index 00000000..06a44152 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/AuthorizedParties/AsResourceOwner/InstDelgParties_AsResOwner_ToPerson_SubOnly_InclA2.bru @@ -0,0 +1,69 @@ +meta { + name: InstDelgParties_AsResOwner_ToPerson_SubOnly_InclA2 + type: http + seq: 4 +} + +post { + url: {{baseUrl}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=true + body: json + auth: inherit +} + +params:query { + includeAltinn2: true +} + +headers { + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "type": "urn:altinn:person:identifier-no", + "value": "{{toPersonId}}" + } +} + +script:pre-request { + const sharedtestdata = require(`./Testdata/sharedtestdata.json`); + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + + var getTokenParameters = { + auth_tokenType: sharedtestdata.authTokenType.enterprise, + auth_org: sharedtestdata.serviceOwners.ttd.org, + auth_orgNo: sharedtestdata.serviceOwners.ttd.orgno, + auth_scopes: sharedtestdata.auth_scopes.authorizedPartiesResourceOwner + } + + const token = await testTokenGenerator.getToken(getTokenParameters); + bru.setVar("bearerToken", token); + + bru.setVar("toPersonId", testdata.persons.spesifikkSmaragd.personId); +} + +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 = "InstDelgParties_AsResOwner_ToPerson_SubOnly_InclA2"; + const testdata = require(`./Testdata/instance-delegation-authorized-parties/${bru.getEnvVar("tokenEnv")}.json`); + const body = res.getBody(); + + test(requestName + "|HttpStatus.OK", function() { + expect(res.status).to.equal(200); + }); + + test(requestName + "|Contains_SubOnly2P_MainUnitOnlyHierarchy_SubunitWithInstanceIds", function() { + const mainUnit = body.find(party => party.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from)); + assert.isOk(mainUnit, `Subunit was not found as a subunit on any party in AuthorizedParties for recipient`); + assert.isOk(mainUnit.onlyHierarchyElementWithNoAccess, `Expected mainUnit.onlyHierarchyElementWithNoAccess to be true. Recipient should only have Subunit access.`); + + const subunit = mainUnit.subunits.find(subunit => subunit.partyUuid === testdata.instances.subonly2p.from); + + const subunitInstanceDelegation_1 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_1); + assert.isOk(subunitInstanceDelegation_1, `InstanceId ${testdata.instances.subonly2p.instanceId_1} not found in AuthorizedInstances on Subunit having delegated the instance`); + + const subunitInstanceDelegation_2 = subunit.authorizedInstances.find(delegation => delegation.instanceId === testdata.instances.subonly2p.instanceId_2); + assert.isOk(subunitInstanceDelegation_2, `InstanceId ${testdata.instances.subonly2p.instanceId_2} not found in AuthorizedInstances on Subunit having delegated the instance`); + }); +} diff --git a/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/at22.json b/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/at22.json new file mode 100644 index 00000000..39d94666 --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/at22.json @@ -0,0 +1,113 @@ +{ + "env": "at22", + "resources": { + "appInstanceDelegation": { + "resourceId": "app_ttd_authz-bruno-instancedelegation", + "org": "ttd", + "app": "authz-bruno-instancedelegation" + } + }, + "instances": { + "p2p": { + "instanceId": "93994414-07dc-4df3-b2c6-047722169b6c", + "from": "5daf2382-adee-4cd6-9995-3c5f3fc058af", + "to": "bd90e954-efe5-4b65-be8a-f9fccbb36342" + }, + "main2p": { + "instanceId": "df333e75-5896-4254-a69f-146736eaf668", + "from": "01712d4f-cfb2-4d12-8aac-2eb7ad0d9c86", + "to": "bd90e954-efe5-4b65-be8a-f9fccbb36342" + }, + "sub2p": { + "instanceId": "49513daa-beb1-4a83-a07e-83da1378c8a9", + "from": "e21a640b-9558-4d59-b47f-7b87d2cd9ee0", + "to": "bd90e954-efe5-4b65-be8a-f9fccbb36342" + }, + "subonly2p": { + "instanceId_1": "a5215400-1de1-46eb-abff-54aac49745e2", + "instanceId_2": "6afa0a58-a6d1-4ff3-9973-7040cef0763a", + "from": "e21a640b-9558-4d59-b47f-7b87d2cd9ee0", + "to": "db684960-0b7d-4c11-b948-1ec9268c4a13" + }, + "o2o": { + "instanceId": "0d55d70c-6e81-4728-b0e6-7ff1ede1a4fe", + "from": "f7e2eb77-6b5e-4aeb-9fe9-f261013401c9", + "to": "01712d4f-cfb2-4d12-8aac-2eb7ad0d9c86" + }, + "p2o": { + "instanceId_1": "6ad65bea-59f4-462c-9077-04ac488322b6", + "instanceId_2": "23820c6b-4ba4-412d-8781-b92517cb3715", + "from": "db684960-0b7d-4c11-b948-1ec9268c4a13", + "to": "01712d4f-cfb2-4d12-8aac-2eb7ad0d9c86" + } + }, + "organizations": { + "mobilBeskjedenTiger": { + "partyUuid": "f7e2eb77-6b5e-4aeb-9fe9-f261013401c9", + "name": "MOBIL BESKJEDEN TIGER AS", + "organizationNumber": "310705071", + "partyId": 51373625, + "subunits": { + "mobilBeskjedenTiger": { + "partyUuid": "2177ee69-fd11-4b38-904a-e0e2f1958f86", + "name": "MOBIL BESKJEDEN TIGER AS", + "organizationNumber": "314410343", + "partyId": 51690212, + "dagl": null + } + }, + "dagl": { + "name": "HAKKE DYR", + "personId": "29917997339", + "userId": 20012883, + "partyUuid": "bd90e954-efe5-4b65-be8a-f9fccbb36342", + "partyId": 50127680 + } + }, + "legitimJusterbarTiger": { + "partyUuid": "01712d4f-cfb2-4d12-8aac-2eb7ad0d9c86", + "name": "LEGITIM JUSTERBAR TIGER AS", + "organizationNumber": "311041371", + "partyId": 51403263, + "subunits": { + "legitimJusterbarTiger": { + "partyUuid": "e21a640b-9558-4d59-b47f-7b87d2cd9ee0", + "name": "LEGITIM JUSTERBAR TIGER AS", + "organizationNumber": "315684617", + "partyId": 51806076, + "dagl": null + } + }, + "dagl": { + "name": "ØVELSE EMPIRISK", + "personId": "25884699358", + "userId": 20012882, + "partyUuid": "5daf2382-adee-4cd6-9995-3c5f3fc058af", + "partyId": 51195601 + } + } + }, + "persons": { + "ovelseEmpirisk": { + "name": "ØVELSE EMPIRISK", + "personId": "25884699358", + "userId": 20012882, + "partyUuid": "5daf2382-adee-4cd6-9995-3c5f3fc058af", + "partyId": 51195601 + }, + "hakkeDyr": { + "name": "HAKKE DYR", + "personId": "29917997339", + "userId": 20012883, + "partyUuid": "bd90e954-efe5-4b65-be8a-f9fccbb36342", + "partyId": 50127680 + }, + "spesifikkSmaragd": { + "name": "SPESIFIKK SMARAGD", + "personId": "05869598129", + "userId": 20012925, + "partyUuid": "db684960-0b7d-4c11-b948-1ec9268c4a13", + "partyId": 50370250 + } + } +} \ No newline at end of file diff --git a/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/tt02.json b/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/tt02.json new file mode 100644 index 00000000..ba9b8f8d --- /dev/null +++ b/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation-authorized-parties/tt02.json @@ -0,0 +1,113 @@ +{ + "env": "tt02", + "resources": { + "appInstanceDelegation": { + "resourceId": "app_ttd_authz-bruno-instancedelegation", + "org": "ttd", + "app": "authz-bruno-instancedelegation" + } + }, + "instances": { + "p2p": { + "instanceId": "16e679bc-9bb9-46f9-86e1-3657b267af26", + "from": "f9b2750f-f2aa-442c-91b7-418e2f627a8b", + "to": "07336d43-1f0e-40a8-a02b-2c6019013cc7" + }, + "main2p": { + "instanceId": "e0c55fe6-442b-4442-aabc-aeafda8d94fe", + "from": "58c0acd2-793e-48f1-a19f-169c171066f4", + "to": "07336d43-1f0e-40a8-a02b-2c6019013cc7" + }, + "sub2p": { + "instanceId": "3e8b4812-c26c-4bfa-82f5-5c99c9ad90e3", + "from": "65018cec-9bd4-45ad-998d-357ac181eaf3", + "to": "07336d43-1f0e-40a8-a02b-2c6019013cc7" + }, + "subonly2p": { + "instanceId_1": "ab194d3a-96a4-4237-8fb9-3a995cb177a6", + "instanceId_2": "1a404054-17b1-432a-979f-5be965441e5c", + "from": "65018cec-9bd4-45ad-998d-357ac181eaf3", + "to": "6971e33b-59c2-4605-8bdb-7ce3257fd1c7" + }, + "o2o": { + "instanceId": "1f80ab14-ef45-48ab-8fef-7c5562683706", + "from": "9d263473-4f08-459e-bf27-1de535c40607", + "to": "58c0acd2-793e-48f1-a19f-169c171066f4" + }, + "p2o": { + "instanceId_1": "a75f521f-e00c-4f1c-ab1d-1843e04bfc77", + "instanceId_2": "1946c07c-c785-4131-9d3c-f6ffe5c8f560", + "from": "6971e33b-59c2-4605-8bdb-7ce3257fd1c7", + "to": "58c0acd2-793e-48f1-a19f-169c171066f4" + } + }, + "organizations": { + "mobilBeskjedenTiger": { + "partyUuid": "9d263473-4f08-459e-bf27-1de535c40607", + "name": "MOBIL BESKJEDEN TIGER AS", + "organizationNumber": "310705071", + "partyId": 51587157, + "subunits": { + "mobilBeskjedenTiger": { + "partyUuid": "4f849f61-c36f-470a-b0b5-924568e3e10a", + "name": "MOBIL BESKJEDEN TIGER AS", + "organizationNumber": "314410343", + "partyId": 51903584, + "dagl": null + } + }, + "dagl": { + "name": "HAKKE DYR", + "personId": "29917997339", + "userId": 1424053, + "partyUuid": "07336d43-1f0e-40a8-a02b-2c6019013cc7", + "partyId": 51015472 + } + }, + "legitimJusterbarTiger": { + "partyUuid": "58c0acd2-793e-48f1-a19f-169c171066f4", + "name": "LEGITIM JUSTERBAR TIGER AS", + "organizationNumber": "311041371", + "partyId": 51616797, + "subunits": { + "legitimJusterbarTiger": { + "partyUuid": "65018cec-9bd4-45ad-998d-357ac181eaf3", + "name": "LEGITIM JUSTERBAR TIGER AS", + "organizationNumber": "315684617", + "partyId": 52019430, + "dagl": null + } + }, + "dagl": { + "name": "ØVELSE EMPIRISK", + "personId": "25884699358", + "userId": 1424054, + "partyUuid": "f9b2750f-f2aa-442c-91b7-418e2f627a8b", + "partyId": 51443447 + } + } + }, + "persons": { + "ovelseEmpirisk": { + "name": "ØVELSE EMPIRISK", + "personId": "25884699358", + "userId": 1424054, + "partyUuid": "f9b2750f-f2aa-442c-91b7-418e2f627a8b", + "partyId": 51443447 + }, + "hakkeDyr": { + "name": "HAKKE DYR", + "personId": "29917997339", + "userId": 1424053, + "partyUuid": "07336d43-1f0e-40a8-a02b-2c6019013cc7", + "partyId": 51015472 + }, + "spesifikkSmaragd": { + "name": "SPESIFIKK SMARAGD", + "personId": "05869598129", + "userId": 1416991, + "partyUuid": "6971e33b-59c2-4605-8bdb-7ce3257fd1c7", + "partyId": 50826949 + } + } +} From bbf46b070cdddf7496f39846670156f20471eaba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Kjetil=20=C3=98ye?= Date: Fri, 22 Nov 2024 21:02:34 +0100 Subject: [PATCH 2/2] Fixed typo and casing issue with existing instance delegation testdata path --- .../DelegateGetRevokeSeries/1. DelegateInstanceRights.bru | 4 ++-- .../DelegateGetRevokeSeries/2. GetInstanceRights.bru | 4 ++-- .../DelegateGetRevokeSeries/3. RevokeInstanceRead.bru | 4 ++-- .../DelegateGetRevokeSeries/4. GetInstanceRights.bru | 4 ++-- .../DelegateGetRevokeSeries/5. RevokeInstanceSign.bru | 4 ++-- .../DelegateGetRevokeSeries/6. GetInstanceRights.bru | 4 ++-- .../NegativeTests/DelegateExistingAppNoRightsDelegable.bru | 4 ++-- .../NegativeTests/DelegateNonExistingResource.bru | 4 ++-- .../NegativeTests/DelegateWrongFrom.bru | 4 ++-- .../AppsInstanceDelegation/NegativeTests/DelegateWrongTo.bru | 4 ++-- .../NegativeTests/GetInstanceDelegationNoRightsToDelegate.bru | 4 ++-- .../GetInstanceDelegationNonExistingResource.bru | 4 ++-- .../AT22testdata.json => instance-delegation/at22.json} | 0 .../TT02testdata.json => instance-delegation/tt02.json} | 0 14 files changed, 24 insertions(+), 24 deletions(-) rename test/Bruno/Altinn.AccessManagement/Testdata/{instanse-delegation/AT22testdata.json => instance-delegation/at22.json} (100%) rename test/Bruno/Altinn.AccessManagement/Testdata/{instanse-delegation/TT02testdata.json => instance-delegation/tt02.json} (100%) diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/1. DelegateInstanceRights.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/1. DelegateInstanceRights.bru index 295119b4..0f60d6f8 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/1. DelegateInstanceRights.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/1. DelegateInstanceRights.bru @@ -63,7 +63,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -84,7 +84,7 @@ script:pre-request { tests { test("post InstanceDelegation ReadSign", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/2. GetInstanceRights.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/2. GetInstanceRights.bru index ca72390a..921aa4d7 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/2. GetInstanceRights.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/2. GetInstanceRights.bru @@ -16,7 +16,7 @@ headers { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -35,7 +35,7 @@ script:pre-request { tests { test("get InstanceDelegation ReadSign", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/3. RevokeInstanceRead.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/3. RevokeInstanceRead.bru index 5975a788..864a6549 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/3. RevokeInstanceRead.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/3. RevokeInstanceRead.bru @@ -47,7 +47,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -66,7 +66,7 @@ script:pre-request { tests { test("post InstanceDelegation RevokeRead", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/4. GetInstanceRights.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/4. GetInstanceRights.bru index d0f40630..ebce9fec 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/4. GetInstanceRights.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/4. GetInstanceRights.bru @@ -16,7 +16,7 @@ headers { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -35,7 +35,7 @@ script:pre-request { tests { test("get InstanceDelegation Sign", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/5. RevokeInstanceSign.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/5. RevokeInstanceSign.bru index 0b88468a..7dec4fa7 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/5. RevokeInstanceSign.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/5. RevokeInstanceSign.bru @@ -47,7 +47,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -66,7 +66,7 @@ script:pre-request { tests { test("post InstanceDelegation RevokeSign", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/6. GetInstanceRights.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/6. GetInstanceRights.bru index b9ae3080..6ee4543e 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/6. GetInstanceRights.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/DelegateGetRevokeSeries/6. GetInstanceRights.bru @@ -16,7 +16,7 @@ headers { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -35,7 +35,7 @@ script:pre-request { tests { test("get InstanceDelegation EmptyResponce", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateExistingAppNoRightsDelegable.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateExistingAppNoRightsDelegable.bru index 23ee214b..45985887 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateExistingAppNoRightsDelegable.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateExistingAppNoRightsDelegable.bru @@ -63,7 +63,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + "authz-bruno-testapp1"; bru.setVar("resourceId", resource); @@ -84,7 +84,7 @@ script:pre-request { tests { test("post InstanceDelegation NoRights", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateNonExistingResource.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateNonExistingResource.bru index f45ed58a..cb1ec2ca 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateNonExistingResource.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateNonExistingResource.bru @@ -63,7 +63,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_NonExistingApp"; bru.setVar("resourceId", resource); @@ -84,7 +84,7 @@ script:pre-request { tests { test("post InstanceDelegation NoResource", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_NonExistingApp"; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongFrom.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongFrom.bru index 03e558a9..096f697a 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongFrom.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongFrom.bru @@ -63,7 +63,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -84,7 +84,7 @@ script:pre-request { tests { test("post InstanceDelegation NotExistFrom", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongTo.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongTo.bru index cd3d4f35..57437365 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongTo.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/DelegateWrongTo.bru @@ -63,7 +63,7 @@ body:json { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; bru.setVar("resourceId", resource); @@ -84,7 +84,7 @@ script:pre-request { tests { test("post InstanceDelegation NotExistTo", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + testdata.app; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNoRightsToDelegate.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNoRightsToDelegate.bru index b9e5f801..d3567897 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNoRightsToDelegate.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNoRightsToDelegate.bru @@ -16,7 +16,7 @@ headers { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + "authz-bruno-testapp1"; bru.setVar("resourceId", resource); @@ -37,7 +37,7 @@ script:pre-request { tests { test("get InstanceDelegation NoRihts", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + "ttd/authz-bruno-testapp1"; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNonExistingResource.bru b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNonExistingResource.bru index 64a5fe13..fb058647 100644 --- a/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNonExistingResource.bru +++ b/test/Bruno/Altinn.AccessManagement/Automatic Test Collection/AppsInstanceDelegation/NegativeTests/GetInstanceDelegationNonExistingResource.bru @@ -16,7 +16,7 @@ headers { script:pre-request { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_NonExistingApp"; bru.setVar("resourceId", resource); @@ -37,7 +37,7 @@ script:pre-request { tests { test("get InstanceDelegation NoResource", function() { const sharedtestdata = require(`./Testdata/sharedtestdata.json`); - const testdata = require(`./Testdata/instanse-delegation/${bru.getEnvVar("tokenEnv")}testdata.json`); + const testdata = require(`./Testdata/instance-delegation/${bru.getEnvVar("tokenEnv")}.json`); const resource = "app_" + sharedtestdata.serviceOwners.ttd.org + "_" + "authz-bruno-testapp1"; const data = res.getBody(); diff --git a/test/Bruno/Altinn.AccessManagement/Testdata/instanse-delegation/AT22testdata.json b/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation/at22.json similarity index 100% rename from test/Bruno/Altinn.AccessManagement/Testdata/instanse-delegation/AT22testdata.json rename to test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation/at22.json diff --git a/test/Bruno/Altinn.AccessManagement/Testdata/instanse-delegation/TT02testdata.json b/test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation/tt02.json similarity index 100% rename from test/Bruno/Altinn.AccessManagement/Testdata/instanse-delegation/TT02testdata.json rename to test/Bruno/Altinn.AccessManagement/Testdata/instance-delegation/tt02.json