Files
itworx-knowledge-hub-Public/tests/backend/ItWorx.KnowledgeHub.Api.Tests/PlatformEndpointAuthorizationTests.cs
T

27 lines
834 B
C#

using System.Net;
namespace ItWorx.KnowledgeHub.Api.Tests;
public sealed class PlatformEndpointAuthorizationTests : IClassFixture<KnowledgeHubApiFactory>
{
private readonly HttpClient _client;
public PlatformEndpointAuthorizationTests(KnowledgeHubApiFactory factory) => _client = factory.CreateClient();
[Fact]
public async Task Anonymous_callers_cannot_read_personal_preferences()
{
using var response = await _client.GetAsync("/api/v1/me/preferences");
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
}
[Fact]
public async Task Anonymous_callers_cannot_read_operator_platform_settings()
{
using var response = await _client.GetAsync("/api/v1/admin/platform-settings");
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
}
}