Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
tl-Roberto-Mancinelli committed Dec 5, 2024
1 parent fd57917 commit 2fbdeea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/TrueLayer/Auth/AuthApiCacheDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal class AuthApiCacheDecorator : IAuthApi
{
private readonly IAuthApi _client;
private readonly IAuthTokenCache _authTokenCache;
private readonly TimeSpan _minTimeToRenew = TimeSpan.FromSeconds(30);
private readonly TimeSpan _minTimeToRenew = TimeSpan.FromMinutes(1);
private const string KeyPrefix = "tl-auth-token-";

public AuthApiCacheDecorator(IAuthApi client, IAuthTokenCache authTokenCache)
Expand Down
17 changes: 5 additions & 12 deletions test/TrueLayer.Tests/ApiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ApiClientTests : IDisposable
private readonly MockHttpMessageHandler _httpMessageHandler;
private readonly ApiClient _apiClient;
private readonly TestResponse _stub;
private readonly string _privateKey = @"-----BEGIN EC PRIVATE KEY-----
private const string PrivateKey = @"-----BEGIN EC PRIVATE KEY-----
MIHcAgEBBEIALJ2sKM+8mVDfTIlk50rqB5lkxaLBt+OECvhXq3nEaB+V0nqljZ9c
5aHRN3qqxMzNLvxFQ+4twifa4ezkMK2/j5WgBwYFK4EEACOhgYkDgYYABADmhZbj
i8bgJRfMTdtzy+5VbS5ScMaKC1LQfhII+PTzGzOr+Ts7Qv8My5cmYU5qarGK3tWF
Expand Down Expand Up @@ -185,7 +185,7 @@ public async Task Given_request_fails_returns_unsuccessful_response(HttpStatusCo
[Fact]
public async Task Given_request_fails_returns_problem_details()
{
string json = @"
const string json = @"
{
""type"": ""https://docs.truelayer.com/errors#invalid_parameters"",
""title"": ""Validation Error"",
Expand Down Expand Up @@ -244,7 +244,7 @@ public async Task Generates_request_signature_when_signing_key_and_body_provided
key = "value"
};

var signingKey = new SigningKey { KeyId = Guid.NewGuid().ToString(), PrivateKey = _privateKey };
var signingKey = new SigningKey { KeyId = Guid.NewGuid().ToString(), PrivateKey = PrivateKey };

var requestUri = new Uri("http://localhost/signing");
var idempotencyKey = Guid.NewGuid().ToString();
Expand All @@ -265,12 +265,7 @@ public async Task Generates_request_signature_when_signing_key_and_body_provided
[Fact]
public async Task Generates_request_signature_when_signing_key_and_no_content_provided()
{
var obj = new
{
key = "value"
};

var signingKey = new SigningKey { KeyId = Guid.NewGuid().ToString(), PrivateKey = _privateKey };
var signingKey = new SigningKey { KeyId = Guid.NewGuid().ToString(), PrivateKey = PrivateKey };

var requestUri = new Uri("http://localhost/signing");
var idempotencyKey = Guid.NewGuid().ToString();
Expand All @@ -281,7 +276,7 @@ public async Task Generates_request_signature_when_signing_key_and_no_content_pr
.WithHeaders(CustomHeaders.IdempotencyKey, idempotencyKey)
.Respond(HttpStatusCode.OK, MediaTypeNames.Application.Json, "{}");

var response = await _apiClient.PostAsync<TestResponse>(
await _apiClient.PostAsync<TestResponse>(
requestUri,
null,
idempotencyKey: idempotencyKey,
Expand Down Expand Up @@ -311,8 +306,6 @@ public async Task Omits_signature_when_no_signing_key_provided()
idempotencyKey: idempotencyKey);
}

public record UserAgentResponse(string Value);

private static void AssertSame(TestResponse? response, TestResponse expected)
{
response.Should().NotBeNull();
Expand Down
44 changes: 0 additions & 44 deletions test/TrueLayer.Tests/MockBankClient.cs

This file was deleted.

0 comments on commit 2fbdeea

Please sign in to comment.