-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implement IMaskinportenClient interface #669
Conversation
test/Altinn.App.Core.Tests/Features/Maskinporten/Delegates/MaskinportenDelegatingHandlerTest.cs
Fixed
Show fixed
Hide fixed
test/Altinn.App.Core.Tests/Features/Maskinporten/Delegates/MaskinportenDelegatingHandlerTest.cs
Dismissed
Show dismissed
Hide dismissed
test/Altinn.App.Core.Tests/Features/Maskinporten/Delegates/MaskinportenDelegatingHandlerTest.cs
Dismissed
Show dismissed
Hide dismissed
test/Altinn.App.Core.Tests/Features/Maskinporten/MaskinportenClientTest.cs
Fixed
Show fixed
Hide fixed
test/Altinn.App.Core.Tests/Features/Maskinporten/MaskinportenClientTest.cs
Fixed
Show fixed
Hide fixed
test/Altinn.App.Core.Tests/Features/Maskinporten/MaskinportenClientTest.cs
Fixed
Show fixed
Hide fixed
src/Altinn.App.Core/Features/Maskinporten/MaskinportenClient.cs
Dismissed
Show dismissed
Hide dismissed
src/Altinn.App.Core/Features/Maskinporten/MaskinportenClient.cs
Dismissed
Show dismissed
Hide dismissed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ser bra ut. Noen raske kommentarer (håper de er gode).
WebApplicationFactory
Savner en full test der du bruker WebApplicationFactory til å hente token til en IOptionProvider
, for å teste hele løpet, men det blir kanskje for mye mocking av litt mange http klienter til at det egentlig gir verdi. (mulig CustomWebApplicationFactory.SendAsync gjør at du kan teste med flere http klienter og at maskinporten delegating handler kommer i forkant.)
app-lib-dotnet/test/Altinn.App.Api.Tests/CustomWebApplicationFactory.cs
Lines 212 to 215 in 0161134
protected Func<HttpRequestMessage, Task<HttpResponseMessage>> SendAsync { get; set; } = | |
(request) => | |
throw new NotImplementedException("You must set SendAsync in your test when it uses a real http client."); | |
} |
Tid
Har ikke gjort det selv, men det finnes interfaces for å gjøre det enklere å teste cache expiration med tid (uten Task.Delay som gjør testene veeeldig trege)
src/Altinn.App.Core/EFormidling/Implementation/EformidlingStatusCheckEventHandler2.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/EFormidling/Implementation/EformidlingStatusCheckEventHandler2.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/Converters/JsonWebKeyConverter.cs
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/MaskinportenClient.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/MaskinportenClient.cs
Outdated
Show resolved
Hide resolved
test/Altinn.App.Core.Tests/Features/Maskinporten/Models/MaskinportenSettingsTest.cs
Outdated
Show resolved
Hide resolved
Comments on what CS0618 is Co-authored-by: Ivar Nesje <ivarne@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
I made a small change to UseMaskinportenAuthorization
and the related test since I found it easier than to explain, hope that's OK
src/Altinn.App.Core/Features/Maskinporten/Converters/JsonWebKeyConverter.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/Converters/JsonWebKeyConverter.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/Exceptions/MaskinportenException.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/Exceptions/MaskinportenTokenExpiredException.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Features/Maskinporten/Models/MaskinportenSettings.cs
Outdated
Show resolved
Hide resolved
Jeg synes vi har ganske bra dekning på alle komponentene nå, men det jeg savner selv er vel en faktisk implementasjon med en test-mottaker som kan ta imot en request og verifisere at All annen mocking blir bare ... mer mocking. Ta gjerne en titt på den litt oppdaterte testen her og se om det hjelper noe på magefølelsen.
Veldig interessert i dette! Skal ta en titt 😄 |
Very appreciated and more than okay! 🙏 |
It does not work with semaphore locking
`JsonConverter` was not respected in all code paths, leading to inconsistencies between systems and versions. Additionally we want to support a base64 encoding of the JWK for ease of runtime configuration (legacy). All of which would have been sweet with a JsonConverter, but alas.
src/Altinn.App.Core/Features/Maskinporten/Converters/JsonWebKeyConverter.cs
Dismissed
Show dismissed
Hide dismissed
test/Altinn.App.Core.Tests/Features/Maskinporten/Models/MaskinportenSettingsTest.cs
Dismissed
Show dismissed
Hide dismissed
test/Altinn.App.Core.Tests/Features/Maskinporten/Models/MaskinportenSettingsTest.cs
Dismissed
Show dismissed
Hide dismissed
src/Altinn.App.Core/Features/Maskinporten/MaskinportenClient.cs
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
This reverts commit d6bfccc.
Setting ignore-for-release since this had to be reverted from main due to a preview dependency, which is not allowed. There will be a new PR for this later. |
Description
Implements IMaskinportenClient interface as per proof of concept project.
Related Issue(s)
Verification
Documentation