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

Library version v8.0.0 #13

Merged
merged 38 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e494986
Change type of TransactionTotalDays to uint instead of int
RobinTTY Apr 5, 2024
395a48b
Reorganize test project to prepare for mocked unit tests
RobinTTY Apr 5, 2024
37c864d
Implement AccountsEndpointTests using mocks
RobinTTY Apr 8, 2024
11f741d
Implement AgreementsEndpointTests using mocks
RobinTTY Apr 8, 2024
49fc096
Rename TestExtensions to TestHelpers
RobinTTY Apr 15, 2024
62301f1
Add new fields to Institution class
RobinTTY Apr 15, 2024
011820a
Add mock data
RobinTTY Apr 15, 2024
c780b08
Add mocked institutions tests
RobinTTY Apr 15, 2024
b82b8b7
Add mocked requisitions tests, fix wrong json field name
RobinTTY Apr 15, 2024
59b0f7c
Add mocked token endpoint tests
RobinTTY Apr 15, 2024
cf32ada
Add test for incorrectly provided credentials
RobinTTY Apr 17, 2024
8050001
Remove unnecessary differentiation between BasicResponse and BasicError
RobinTTY Apr 17, 2024
a3c59b3
Simplify TestHelpers, add test for unsuccessful token retrieval
RobinTTY Apr 18, 2024
c1f7ba7
Modify behaviour of the API client to return token renewal errors imm…
RobinTTY Apr 19, 2024
4f5f99c
Move CredentialTests to TokenEndpointTests where appropriate, improve…
RobinTTY Apr 20, 2024
2547c74
Simplify mocked tests
RobinTTY Apr 20, 2024
c0b2df1
Immediately throw exception when GetTransactions endDate lies before …
RobinTTY Apr 21, 2024
069aa40
Refactor authentication related tests
RobinTTY Apr 21, 2024
df08bdd
Refactor existing test classes to be public
RobinTTY Apr 21, 2024
ac841ab
Refactor existing test classes to use correct naming
RobinTTY Apr 21, 2024
12e0527
Move accessing secrets to TestHelpers.cs
RobinTTY Apr 21, 2024
319c6e0
Add global System.Net using
RobinTTY Apr 21, 2024
819d4ee
Add ExecuteRequestWithUnauthorizedIp test
RobinTTY Apr 21, 2024
5ae5f69
Add test for rate limit
RobinTTY Apr 21, 2024
8f6ea2f
Add GetAccountThatDoesNotExist test
RobinTTY Apr 22, 2024
80e702a
Add some more tests regarding errors from the AccountsEndpoint
RobinTTY Apr 22, 2024
80e1c61
Add StringArrayMergeConverter to process inconsistencies in API respo…
RobinTTY Apr 25, 2024
456fdc4
Create mocked tests for agreements endpoint errors
RobinTTY Apr 25, 2024
5c07e5b
Create tests for and fix deserialization of CreateAgreementError
RobinTTY Apr 26, 2024
8e5b8e6
Reorganize tests
RobinTTY Apr 26, 2024
3e9cdff
Add mocked institutions endpoint tests, simplify return type
RobinTTY Apr 26, 2024
f28cde8
Fix some comparison inconsistencies
RobinTTY Apr 26, 2024
323c970
Fix CreateRequisition error deserialization
RobinTTY Apr 27, 2024
85d4bf6
Remove unnecessary xml comments
RobinTTY Apr 27, 2024
61938f0
Fix error deserialization for CreateAgreementError
RobinTTY Apr 27, 2024
9f57762
Fix error deserialization for InstitutionsErrorInternal
RobinTTY Apr 27, 2024
d6c712e
Always return Lists instead of IEnumerable in some places
RobinTTY Apr 27, 2024
a5834d0
Add new release, update packages
RobinTTY Apr 27, 2024
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
@@ -1,17 +1,22 @@
using Microsoft.IdentityModel.JsonWebTokens;
using RobinTTY.NordigenApiClient.Models;
using RobinTTY.NordigenApiClient.Models.Jwt;
using RobinTTY.NordigenApiClient.Utility;

namespace RobinTTY.NordigenApiClient.Tests;

internal class JsonWebTokenPairTests
/// <summary>
/// Tests aspects of authentication related to the <see cref="NordigenClientCredentials"/> and <see cref="JsonWebTokenPair"/> classes.
/// </summary>
internal class AuthenticationTests
{
private NordigenClient _apiClient = null!;

[OneTimeSetUp]
public void Setup()
/// <summary>
/// Tests creating <see cref="NordigenClientCredentials"/>, passing null as an argument.
/// </summary>
[Test]
public void CreateCredentialsWithNull()
{
_apiClient = TestExtensions.GetConfiguredClient();
Assert.Throws<ArgumentNullException>(() => { _ = new NordigenClientCredentials(null!, null!); });
}

/// <summary>
Expand Down Expand Up @@ -48,22 +53,6 @@ public void CreateInvalidJsonWebTokenPair()
Assert.Throws<ArgumentException>(() => new JsonWebTokenPair(exampleToken, exampleToken));
}

/// <summary>
/// Tests that <see cref="NordigenClient.JsonWebTokenPair" /> is populated after the first authenticated request is made.
/// </summary>
[Test]
public async Task CheckValidTokensAfterRequest()
{
Assert.That(_apiClient.JsonWebTokenPair, Is.Null);
await _apiClient.RequisitionsEndpoint.GetRequisitions(5, 0, CancellationToken.None);
Assert.Multiple(() =>
{
Assert.That(_apiClient.JsonWebTokenPair, Is.Not.Null);
Assert.That(_apiClient.JsonWebTokenPair!.AccessToken.EncodedToken, Has.Length.GreaterThan(0));
Assert.That(_apiClient.JsonWebTokenPair!.RefreshToken.EncodedToken, Has.Length.GreaterThan(0));
});
}

/// <summary>
/// Tests the token expiry extension method for correct behavior respecting time zones.
/// </summary>
Expand Down
85 changes: 0 additions & 85 deletions src/RobinTTY.NordigenApiClient.Tests/CredentialTests.cs

This file was deleted.

Loading
Loading