Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Chore/Create mock solution for reusability of unittest mocks and data #448

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
/// <summary>
/// Gets or sets the access management ui base url.
/// </summary>
public string FrontendBaseUrl { get; set; }

Check warning on line 11 in backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Core/Configuration/GeneralSettings.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'FrontendBaseUrl' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 11 in backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Core/Configuration/GeneralSettings.cs

View workflow job for this annotation

GitHub Actions / Analyze

Non-nullable property 'FrontendBaseUrl' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Gets or sets the host name.
/// </summary>
public string Hostname { get; set; }

Check warning on line 16 in backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Core/Configuration/GeneralSettings.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'Hostname' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 16 in backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Core/Configuration/GeneralSettings.cs

View workflow job for this annotation

GitHub Actions / Analyze

Non-nullable property 'Hostname' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Option to disable csrf check
Expand All @@ -23,6 +23,11 @@
/// <summary>
/// Language cookie name
/// </summary>
public string LanguageCookie { get; set; }

Check warning on line 26 in backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Core/Configuration/GeneralSettings.cs

View workflow job for this annotation

GitHub Actions / Build and Test

Non-nullable property 'LanguageCookie' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 26 in backend/src/Altinn.AccessManagement.UI/Altinn.AccessManagement.UI.Core/Configuration/GeneralSettings.cs

View workflow job for this annotation

GitHub Actions / Analyze

Non-nullable property 'LanguageCookie' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Whether or not to use Mock data where available
/// </summary>
public bool UseMockData { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Content Include="Data\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<None Remove="Data\MaskinportenSchema\Delegation\appid-400\from_p50067798\to_810418532\ExpectedOutput_Default.json" />
allinox marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<ItemGroup>
<PackageReference Include="Altinn.App.Common" Version="6.0.2" />
<PackageReference Include="Altinn.Common.PEP" Version="1.3.0" />
<PackageReference Include="JWTCookieAuthentication" Version="3.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Altinn.AccessManagement.UI.Core\Altinn.AccessManagement.UI.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Data\MaskinportenSchema\Delegation\NewFolder\NewFolder\" />
allinox marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Altinn.AccessManagement.UI.Mocks
{
public class Class1
allinox marked this conversation as resolved.
Show resolved Hide resolved
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"to": [
{
"id": "urn:altinn:organizationnumber",
"value": "810418362"
}
],
"rightDelegationResults": [
{
"resource": [
{
"id": "urn:altinn:resource",
"value": "appid-400"
}
],
"action": {
"id": "urn:oasis:names:tc:xacml:1.0:action:action-id",
"value": "ScopeAccess"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"to": [
{
"id": "urn:altinn:organizationnumber",
"value": "810418532"
}
],
"rightDelegationResults": [
{
"resource": [
{
"id": "urn:altinn:resource",
"value": "appid-400"
}
],
"action": {
"id": "urn:oasis:names:tc:xacml:1.0:action:action-id",
"value": "ScopeAccess"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"to": [
{
"id": "urn:altinn:organizationnumber",
"value": "810418362"
}
],
"rightDelegationResults": [
{
"resource": [
{
"id": "urn:altinn:resource",
"value": "appid-402"
}
],
"action": {
"id": "urn:oasis:names:tc:xacml:1.0:action:action-id",
"value": "ScopeAccess"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"to": [
{
"id": "urn:altinn:organizationnumber",
"value": "810418532"
}
],
"rightDelegationResults": [
{
"resource": [
{
"id": "urn:altinn:resource",
"value": "appid-402"
}
],
"action": {
"id": "urn:oasis:names:tc:xacml:1.0:action:action-id",
"value": "ScopeAccess"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,29 @@
"CoveredByOrganizationNumber": "810418532",
"resourceid": "skd_1",
"resourcetype": "MaskinportenSchema"
},
{
"coveredbyname": "LUNDAMO OG FLEINVAR",
"offeredbyname": "VIKESÅ OG ÅLVUNDFJORD",
"offeredbypartyid": 50067798,
"coveredbypartyid": 50004221,
"performedbyuserid": 20000002,
"created": "2022-09-24T22:00:00Z",
"offeredbyorganizationNumber": "910510789",
"CoveredByOrganizationNumber": "810418532",
"resourceid": "skd_1",
"resourcetype": "MaskinportenSchema"
},
{
"coveredbyname": "NORDRE FROGN OG MORTENHALS",
"offeredbyname": "VIKESÅ OG ÅLVUNDFJORD",
"offeredbypartyid": 50067798,
"coveredbypartyid": 50004220,
"performedbyuserid": 20000002,
"created": "2022-09-24T22:00:00Z",
"offeredbyorganizationNumber": "910510789",
"CoveredByOrganizationNumber": "810418362",
"resourceid": "skd_1",
"resourcetype": "MaskinportenSchema"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"created": "2022-10-17T11:37:58.053427Z",
"offeredbyorganizationNumber": "810419342",
"CoveredByOrganizationNumber": "10008387",
"resourceid": "nav1_aa_distribution",
"resourceid": "nav_aa_distribution",
"resourcetype": "MaskinportenSchema"
},
{
Expand All @@ -118,5 +118,29 @@
"CoveredByOrganizationNumber": "10008387",
"resourceid": "skd_1",
"resourcetype": "MaskinportenSchema"
},
{
"coveredbyname": "VIKESÅ OG ÅLVUNDFJORD",
"offeredbyname": "KOLBJORNSVIK OG ROAN",
"offeredbypartyid": 50004226,
"coveredbypartyid": 50067798,
"performedbyuserid": 20000002,
"created": "2022-10-17T11:37:58.053427Z",
"offeredbyorganizationNumber": "810419342",
"CoveredByOrganizationNumber": "910510789",
"resourceid": "nav_aa_distribution",
"resourcetype": "MaskinportenSchema"
},
{
"coveredbyname": "VIKESÅ OG ÅLVUNDFJORD",
"offeredbyname": "KOLBJORNSVIK OG ROAN",
"offeredbypartyid": 50004226,
"coveredbypartyid": 50067798,
"performedbyuserid": 20000002,
"created": "2022-09-24T22:00:00Z",
"offeredbyorganizationNumber": "810419342",
"CoveredByOrganizationNumber": "910510789",
"resourceid": "skd_1",
"resourcetype": "MaskinportenSchema"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"UserId": 20004938,
"UserName": "JarleErKul",
"PhoneNumber": "90001337",
"Email": "1337@altinnstudiotestusers.com",
"PartyId": 50019992,
"Party": {

},
"UserType": 1,
"ProfileSettingPreference": {
"Language": "nb"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,19 @@
"IsDeleted": false,
"OnlyHierarchyElementWithNoAccess": false,
"ChildParties": null
},
{
"partyId": "50067798",
"partyTypeName": 2,
"orgNumber": "910510789",
"ssn": null,
"unitType": "AS",
"name": "VIKESÅ OG ÅLVUNDFJORD",
"isDeleted": false,
"onlyHierarchyElementWithNoAccess": false,
"person": null,
"organisation": null,
"childParties": null
}

]
Loading
Loading