Merge branch 'master' into Client
This commit is contained in:
commit
b7806493a2
@ -22,7 +22,8 @@ public abstract class TimeSeriesBaseControllerTest<TEntity, TDto> : BaseIntegrat
|
|||||||
public TimeSeriesBaseControllerTest(WebAppFactoryFixture factory) : base(factory)
|
public TimeSeriesBaseControllerTest(WebAppFactoryFixture factory) : base(factory)
|
||||||
{
|
{
|
||||||
dbContext.CleanupDbSet<TEntity>();
|
dbContext.CleanupDbSet<TEntity>();
|
||||||
client = factory.GetHttpClient<ITimeSeriesClient<TDto>>(string.Empty);
|
|
||||||
|
client = factory.GetAuthorizedHttpClient<ITimeSeriesClient<TDto>>(string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InsertRangeSuccess(TDto dto)
|
public async Task InsertRangeSuccess(TDto dto)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@ -9,6 +9,7 @@ using Persistence.API;
|
|||||||
using Refit;
|
using Refit;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Persistence.Database.Postgres;
|
using Persistence.Database.Postgres;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Persistence.IntegrationTests;
|
namespace Persistence.IntegrationTests;
|
||||||
public class WebAppFactoryFixture : WebApplicationFactory<Startup>
|
public class WebAppFactoryFixture : WebApplicationFactory<Startup>
|
||||||
@ -80,23 +81,23 @@ public class WebAppFactoryFixture : WebApplicationFactory<Startup>
|
|||||||
return RestService.For<T>(httpClient, RefitSettings);
|
return RestService.For<T>(httpClient, RefitSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public T GetAuthorizedHttpClient<T>(string uriSuffix)
|
public T GetAuthorizedHttpClient<T>(string uriSuffix)
|
||||||
//{
|
{
|
||||||
// var httpClient = GetAuthorizedHttpClient();
|
var httpClient = GetAuthorizedHttpClient();
|
||||||
// if (string.IsNullOrEmpty(uriSuffix))
|
if (string.IsNullOrEmpty(uriSuffix))
|
||||||
// return RestService.For<T>(httpClient, RefitSettings);
|
return RestService.For<T>(httpClient, RefitSettings);
|
||||||
|
|
||||||
// if (httpClient.BaseAddress is not null)
|
if (httpClient.BaseAddress is not null)
|
||||||
// httpClient.BaseAddress = new Uri(httpClient.BaseAddress, uriSuffix);
|
httpClient.BaseAddress = new Uri(httpClient.BaseAddress, uriSuffix);
|
||||||
|
|
||||||
// return RestService.For<T>(httpClient, RefitSettings);
|
return RestService.For<T>(httpClient, RefitSettings);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//private HttpClient GetAuthorizedHttpClient()
|
private HttpClient GetAuthorizedHttpClient()
|
||||||
//{
|
{
|
||||||
// var httpClient = CreateClient();
|
var httpClient = CreateClient();
|
||||||
// var jwtToken = ApiTokenHelper.GetAdminUserToken();
|
////var jwtToken = ApiTokenHelper.GetAdminUserToken();
|
||||||
// httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", jwtToken);
|
//httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", jwtToken);
|
||||||
// return httpClient;
|
return httpClient;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user