Test-user for local testing
We have defined a small set of test users available for local test.
Standard users
These are the standard users in the user selections in localtest.
Sophie Salt
Sophie is a highly resourceful woman living in Oslo. She has established a fitness center chain called DDG Fitness, which currently has three branches in Oslo, Bergen, and Trondheim. Sophie holds the role of CEO (DAGL) and its sub-roles for DDG Fitness AS and its subsidiaries.
Additionally, she is a health expert and has started her own consulting firm for health services. Sophie holds the role of LEDE (Leader) along with associated roles for EAS Health Consulting.
She is also a board member of the housing cooperative where she resides, named “Oslos Vakreste Borettslag” (“Oslo’s Most Beautiful Housing Cooperative”). Sophie holds the role of MEDL (Member) along with associated roles for “Oslos Vakreste Borettslag”.
The roles DAGL and LEDE give Sophie most of the access packages for DDG Fitness AS, EAS Health Consulting and their sub-units, such as Lønn (lonn). If the authorization rules of the app give access through access packages, Sophie will therefore often have access on behalf of these organisations.
Submitters (avgivere)
Pengelens Partner
Pengelens Partner is the accountant for the company DDG Fitness AS. Pengelens also holds the access packages Regnskapsfører med signeringsrettighet (regnskapsforer-med-signeringsrettighet) and Lønn (lonn) for DDG Fitness AS.
Submitters (avgivere)
| Submitter | Roles |
|---|---|
| 01899699552 Pengelens Partner | Private |
| 897069650 DDG Fitness AS | Accountant |
Gjentagende Forelder
Gjentagende Forelder is the auditor for selskapet DDG Fitness AS.
Submitters (avgivere)
| Submitter | Roles |
|---|---|
| 17858296439 Gjentagende Forelder | Private |
| 897069650 DDG Fitness AS | Auditor |
Ola Nordmann
Ola Nordmann is a private individual who can only represent himself. He resides in Stokmarknes.
Submitters (avgivere)
Other users
To test forms related to children and upbringing (kindergarten and school), some specific users have been added.
| Submitter | Children | Income |
|---|---|---|
| 01899699552 Pengelens Partner | 0 | Low |
| 17858296439 Gjentagende Forelder | 3 | Medium |
| 29917097109 Rik forelder | 2 | High |
Note: These originate from Tenor’s test dataset but are listed there under different names.
Systems and System Users
With the newer version of localtest, you can test apps locally using system users.
A built-in system and system user associated with 950474084 Oslos Vakreste Borettslag has been provided.
The system user holds the access packages Regnskapsfører med signeringsrettighet (regnskapsforer-med-signeringsrettighet) and Lønn (lonn) for the housing cooperative.
You can obtain the token using /Home/GetTestSystemUserToken in localtest or visit the webpage /Home/Tokens.
Instance Delegation
Instance delegation is supported in the latest version of localtest,
but the users/submitters you delegate instances from and to must have an associated partyUuid. See the example file below.
App-specific users
If the default set of users doesn’t fit your needs when testing your app locally, you can configure your app to respond
with a JSON document at the URL /[org]/[appId]/testData.json.
The simplest way is to place the file at App/wwwroot/testData.json
Typical customizations you might be interested in include using alternative organization numbers or personal identification numbers, ensuring lookups in APIs your app depends on function correctly, or testing authorization rules with roles different from those assigned to the default users.
Give test users access packages
Access packages group the rights to services that belong together, such as everything to do with payroll. If the authorization rules of the app give access through access packages, you can test the rules locally. Localtest gives the test users the access packages their roles give in Altinn, as well as those you add in accessPackages. Access packages that come through client delegation or other delegations are not available locally. Access packages in localtest need studioctl v0.1.0-preview.31 or newer.
This is how test users get access packages:
- A role gives the same access packages as the role gives in Altinn. For example, a general manager (DAGL) gets most of the access packages for the organisation, and every person gets the citizen access packages for themselves through the private person role (PRIV), also when
partyRolesdoes not list it. - You can give a person more access packages in
accessPackages. The key is thepartyIdof the party the person holds the access packages for. - A sub-unit gets the same access packages as the person holds for the main unit.
- Some roles give access packages only for certain kinds of organisation, such as a business manager (FFØR) for a securities fund. Localtest uses the organisation’s
unitTypein the test data to decide. - You give a system user access packages in
accessPackages. The system user holds them for the organisation it belongs to (orgNumber) and its sub-units.
Write an access package as its name, such as lonn, or as its full URN, such as urn:altinn:accesspackage:lonn. Read more about which roles and access packages exist in Altinn.
App/wwwroot/testData.json{
"$schema": "https://altinncdn.no/schemas/json/test-users/test-users.schema.v1.json",
"persons": [
{
"partyId": 512999,
"userId": 12999,
"ssn": "01019012345",
"firstName": "Kari",
"lastName": "Eksempel",
"partyRoles": {},
"accessPackages": {
"500999": ["lonn", "urn:altinn:accesspackage:skattegrunnlag"]
}
}
],
"orgs": [
{
"partyId": 500999,
"orgNumber": "310123456",
"name": "Eksempel AS",
"unitType": "AS"
}
],
"systems": [
{
"id": "310123456_lonnssystem",
"name": "Lønnssystem",
"systemUsers": [
{
"id": "67eff800-7835-434a-a21a-39bf41c753f2",
"orgNumber": "310123456",
"accessPackages": ["lonn"]
}
]
}
]
}
System users can also have an actions list. It exists only in localtest: when the authorization rules of the app give no answer, it lets the system user perform the listed actions in every app. In Altinn, system users get access through access packages and single rights, so use accessPackages instead.
Json Structure
The JsonSchema helps you write a testData.json
file in an IDE such as VSCode. A full version of users from the TestData-folder is available in
testData.json
{
"$schema": "https://altinncdn.no/schemas/json/test-users/test-users.schema.v1.json",
"persons": [
{
"partyId": 512345,
"partyUuid": "48153af4-265f-4b35-8ed9-232fafbc716e",
"ssn": "01017512345",
"firstName": "Ola",
"middleName": "",
"lastName": "Nordmann",
"customClaims": [
{
"type": "some:extra:claim",
"value": "claimValue",
"valueType": "http://www.w3.org/2001/XMLSchema#string"
}
],
"partyRoles": {
"512345": [
{
"type": "altinn",
"value": "regna"
},
{
"type": "altinn",
"value": "priv"
}
]
},
"addressCity": "Stokarknes",
"addressHouseLetter": null,
"addressHouseNumber": "7",
"addressMunicipalName": "Hadsel",
"addressMunicipalNumber": "1866",
"addressPostalCode": "8450",
"addressStreetName": "Bl\u00E5b\u00E6rveien",
"mailingAddress": "Bl\u00E5b\u00E6reveien 7",
"mailingPostalCity": "Stokmarknes",
"mailingPostalCode": "8450",
"mobileNumber": "87654321",
"telephoneNumber": "12345678",
"email": "test@test.com",
"userId": 12345,
"language": "nb",
"userName": "OlaNordmann"
},
{
"partyId": 501337,
"partyUuid": "e9dd7d91-32d8-4933-a108-07562762d572",
"ssn": "01039012345",
"firstName": "Sophie",
"middleName": "",
"lastName": "Salt",
"customClaims": [
{
"type": "some:extra:claim",
"value": "claimValue",
"valueType": "http://www.w3.org/2001/XMLSchema#string"
}
],
"partyRoles": {
"500000": [
{
"type": "altinn",
"value": "DAGL"
},
{
"type": "altinn",
"value": "UTINN"
}
],
"501337": [
{
"type": "altinn",
"value": "PRIV"
},
{
"type": "altinn",
"value": "UTINN"
}
],
"500700": [
{
"type": "altinn",
"value": "DAGL"
},
{
"type": "altinn",
"value": "UTINN"
}
]
},
"addressCity": "Oslo",
"addressHouseLetter": null,
"addressHouseNumber": "9",
"addressMunicipalName": "Oslo",
"addressMunicipalNumber": "0301",
"addressPostalCode": "0151",
"addressStreetName": "Grev Wedels Plass",
"mailingAddress": "Grev Wedels Plass 9",
"mailingPostalCity": "Oslo",
"mailingPostalCode": "0157",
"mobileNumber": "87654321",
"telephoneNumber": "12345678",
"email": "1337@altinnstudiotestusers.com",
"userId": 1337,
"language": "nn",
"userName": "SophieDDG"
}
],
"orgs": [
{
"partyId": 500000,
"partyUuid": "77cab4d6-84bb-4eb2-91bd-710415a72d8a",
"orgNumber": "897069650",
"parentPartyId": null,
"name": "DDG Fitness",
"businessAddress": "Sofies Gate 1",
"businessPostalCity": "By",
"businessPostalCode": "0170",
"eMailAddress": "central@ddgfitness.no",
"faxNumber": "92110000",
"internetAddress": "http://ddgfitness.no",
"mailingAddress": "Sofies Gate 1",
"mailingPostalCity": "Oslo",
"mailingPostalCode": "0170",
"mobileNumber": "92010000",
"telephoneNumber": "12345678",
"unitStatus": null,
"unitType": "AS"
},
{
"partyId": 500700,
"partyUuid": "117e86a4-117f-41b0-8f2d-c383e2a69f9e",
"orgNumber": "950474084",
"parentPartyId": null,
"name": "Oslos Vakreste Borettslag",
"businessAddress": "Sofies Gate 2",
"businessPostalCity": "By",
"businessPostalCode": "0170",
"eMailAddress": "epost@setra.no",
"faxNumber": "92110000",
"internetAddress": "http://setrabrl.no",
"mailingAddress": "Sofies Gate 2",
"mailingPostalCity": "Oslo",
"mailingPostalCode": "0170",
"mobileNumber": "92010000",
"telephoneNumber": "12345678",
"unitStatus": null,
"unitType": "BRL"
}
],
"systems": [
{
"id": "913312465_sbs",
"name": "Sluttbrukersystem",
"systemUsers": [
{
"id": "d111dbab-d619-4f15-bf29-58fe570a9ae6",
"orgNumber": "950474084",
"actions": [
"read",
"write",
"instantiate",
"sign",
"confirm",
"reject",
"delete"
],
"accessPackages": [
"regnskapsforer-med-signeringsrettighet",
"lonn"
]
}
]
}
]
}

