mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 04:11:10 +00:00
Updates the authorization roles and permissions API routes
This commit is contained in:
1 parent
09681ba1cd
commit
6a2970beba
34 files changed
+116
-116
No files matched your search
+4
-4
@@ -59,7 +59,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnPermissions()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/permissions");
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/permissions");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -82,7 +82,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
{
|
||||
// Act
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync(); // authenticated user, but not admin
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/permissions");
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/permissions");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -95,7 +95,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Unauthorized");
|
||||
problemDetails["detail"].GetString().Should().Be("NotAuthorized");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/permissions");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/auth/permissions");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class GetPermissionsEndpointTests : IClassFixture<AuthenticatedLuminaApiF
|
||||
Func<Task> act = async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync("/api/v1/permissions", cts.Token);
|
||||
await _client.GetAsync("/api/v1/auth/permissions", cts.Token);
|
||||
};
|
||||
|
||||
// Assert
|
||||
|
||||
+6
-6
@@ -71,7 +71,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/roles", request);
|
||||
HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/auth/roles", request);
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -101,7 +101,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/roles", request);
|
||||
HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/auth/roles", request);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -113,7 +113,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Unauthorized");
|
||||
problemDetails["detail"].GetString().Should().Be("NotAuthorized");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/roles", request);
|
||||
HttpResponseMessage response = await _client.PostAsJsonAsync("/api/v1/auth/roles", request);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Conflict);
|
||||
@@ -139,7 +139,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.10");
|
||||
problemDetails["title"].GetString().Should().Be("General.Conflict");
|
||||
problemDetails["detail"].GetString().Should().Be("RoleAlreadyExists");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class AddRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory>
|
||||
Func<Task> act = async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.PostAsJsonAsync("/api/v1/roles", request, cts.Token);
|
||||
await _client.PostAsJsonAsync("/api/v1/auth/roles", request, cts.Token);
|
||||
};
|
||||
|
||||
// Assert
|
||||
|
||||
+8
-8
@@ -72,7 +72,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/roles/{role.Id}");
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/auth/roles/{role.Id}");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
|
||||
@@ -90,7 +90,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
Guid roleId = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/roles/{roleId}");
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/auth/roles/{roleId}");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -102,7 +102,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Unauthorized");
|
||||
problemDetails["detail"].GetString().Should().Be("NotAuthorized");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/roles/{roleId}");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/auth/roles/{roleId}");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
adminRole.Should().NotBeNull("Admin role should exist");
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/roles/{adminRole!.Id}");
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/auth/roles/{adminRole!.Id}");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -128,7 +128,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Forbidden");
|
||||
problemDetails["detail"].GetString().Should().Be("AdminRoleCannotBeDeleted");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/roles/{adminRole!.Id}");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/auth/roles/{adminRole!.Id}");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
Guid nonExistentRoleId = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/roles/{nonExistentRoleId}");
|
||||
HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/auth/roles/{nonExistentRoleId}");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
|
||||
@@ -151,7 +151,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails["title"].GetString().Should().Be("General.NotFound");
|
||||
problemDetails["detail"].GetString().Should().Be("RoleNotFound");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/roles/{nonExistentRoleId}");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/auth/roles/{nonExistentRoleId}");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class DeleteRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
Func<Task> act = async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.DeleteAsync($"/api/v1/roles/{roleId}", cts.Token);
|
||||
await _client.DeleteAsync($"/api/v1/auth/roles/{roleId}", cts.Token);
|
||||
};
|
||||
|
||||
// Assert
|
||||
|
||||
+6
-6
@@ -65,7 +65,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
role.Should().NotBeNull("Admin role should exist");
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/roles/{role!.Id}/permissions");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/auth/roles/{role!.Id}/permissions");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -96,7 +96,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
role.Should().NotBeNull("Admin role should exist");
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/roles/{role!.Id}/permissions");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/auth/roles/{role!.Id}/permissions");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -108,7 +108,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Unauthorized");
|
||||
problemDetails["detail"].GetString().Should().Be("NotAuthorized");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/roles/{role.Id}/permissions");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/auth/roles/{role.Id}/permissions");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
{
|
||||
// Act
|
||||
Guid invalidRoleId = Guid.NewGuid();
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/roles/{invalidRoleId}/permissions");
|
||||
HttpResponseMessage response = await _client.GetAsync($"/api/v1/auth/roles/{invalidRoleId}/permissions");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
|
||||
@@ -129,7 +129,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails["title"].GetString().Should().Be("General.NotFound");
|
||||
problemDetails["detail"].GetString().Should().Be("RoleNotFound");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/roles/{invalidRoleId}/permissions");
|
||||
problemDetails["instance"].GetString().Should().Be($"/api/v1/auth/roles/{invalidRoleId}/permissions");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<AuthenticatedLumina
|
||||
Func<Task> act = async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync($"/api/v1/roles/{role!.Id}/permissions", cts.Token);
|
||||
await _client.GetAsync($"/api/v1/auth/roles/{role!.Id}/permissions", cts.Token);
|
||||
};
|
||||
|
||||
// Assert
|
||||
|
||||
+4
-4
@@ -57,7 +57,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
public async Task ExecuteAsync_WhenCalledWithValidRequest_ShouldReturnRoles()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/roles");
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/roles");
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -81,7 +81,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
_client = await _apiFactory.CreateAuthenticatedClientAsync();
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/roles");
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/roles");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -93,7 +93,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Unauthorized");
|
||||
problemDetails["detail"].GetString().Should().Be("NotAuthorized");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class GetRolesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
|
||||
Func<Task> act = async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.GetAsync("/api/v1/roles", cts.Token);
|
||||
await _client.GetAsync("/api/v1/auth/roles", cts.Token);
|
||||
};
|
||||
|
||||
// Assert
|
||||
|
||||
+6
-6
@@ -82,7 +82,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/roles", request);
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/auth/roles", request);
|
||||
|
||||
// Assert
|
||||
response.EnsureSuccessStatusCode();
|
||||
@@ -114,7 +114,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/roles", request);
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/auth/roles", request);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Forbidden);
|
||||
@@ -126,7 +126,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.4");
|
||||
problemDetails["title"].GetString().Should().Be("General.Unauthorized");
|
||||
problemDetails["detail"].GetString().Should().Be("NotAuthorized");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/roles", request);
|
||||
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/auth/roles", request);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
|
||||
@@ -154,7 +154,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails["title"].GetString().Should().Be("General.NotFound");
|
||||
problemDetails["detail"].GetString().Should().Be("RoleNotFound");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["traceId"].GetString().Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class UpdateRoleEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
|
||||
Func<Task> act = async () =>
|
||||
{
|
||||
cts.Cancel();
|
||||
await _client.PutAsJsonAsync($"/api/v1/roles", request, cts.Token);
|
||||
await _client.PutAsJsonAsync($"/api/v1/auth/roles", request, cts.Token);
|
||||
};
|
||||
|
||||
// Assert
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ using System.Text.Json;
|
||||
namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Admin.Authorization.Permissions;
|
||||
|
||||
/// <summary>
|
||||
/// Contains security tests for the <c>/permissions</c> route.
|
||||
/// Contains security tests for the <c>/auth/permissions</c> route.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPermissionsEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
@@ -34,7 +34,7 @@ public class GetPermissionsEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
public async Task GetPermissions_WhenUnauthorized_ShouldReturnUnauthorizedResult()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/permissions");
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/permissions");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
|
||||
@@ -46,7 +46,7 @@ public class GetPermissionsEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
problemDetails!["status"].GetInt32().Should().Be(StatusCodes.Status401Unauthorized);
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc7235#section-3.1");
|
||||
problemDetails["title"].GetString().Should().Be("Unauthorized");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/permissions");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/auth/permissions");
|
||||
problemDetails["detail"].GetString().Should().Be("Authentication failed");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -11,7 +11,7 @@ using System.Text.Json;
|
||||
namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Admin.Authorization.Roles;
|
||||
|
||||
/// <summary>
|
||||
/// Contains security tests for the <c>/roles</c> route.
|
||||
/// Contains security tests for the <c>/auth/roles</c> route.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AddRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
@@ -43,7 +43,7 @@ public class AddRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
StringContent content = new(JsonSerializer.Serialize(requestBody), Encoding.UTF8, "application/json");
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PostAsync("/api/v1/roles", content);
|
||||
HttpResponseMessage response = await _client.PostAsync("/api/v1/auth/roles", content);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
|
||||
@@ -55,7 +55,7 @@ public class AddRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
problemDetails!["status"].GetInt32().Should().Be(StatusCodes.Status401Unauthorized);
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc7235#section-3.1");
|
||||
problemDetails["title"].GetString().Should().Be("Unauthorized");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["detail"].GetString().Should().Be("Authentication failed");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -10,7 +10,7 @@ using System.Text.Json;
|
||||
namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Admin.Authorization.Roles;
|
||||
|
||||
/// <summary>
|
||||
/// Contains security tests for the <c>/roles/{roleId}</c> route.
|
||||
/// Contains security tests for the <c>/auth/roles/{roleId}</c> route.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DeleteRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
@@ -35,7 +35,7 @@ public class DeleteRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
{
|
||||
// Arrange
|
||||
Guid roleId = Guid.NewGuid();
|
||||
string url = $"/api/v1/roles/{roleId}";
|
||||
string url = $"/api/v1/auth/roles/{roleId}";
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.DeleteAsync(url);
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ using System.Text.Json;
|
||||
namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Admin.Authorization.Roles;
|
||||
|
||||
/// <summary>
|
||||
/// Contains security tests for the <c>/roles/{roleId}/permissions</c> route.
|
||||
/// Contains security tests for the <c>/auth/roles/{roleId}/permissions</c> route.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetRolePermissionsEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
@@ -35,7 +35,7 @@ public class GetRolePermissionsEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
{
|
||||
// Arrange
|
||||
Guid roleId = Guid.NewGuid();
|
||||
string url = $"/api/v1/roles/{roleId}/permissions";
|
||||
string url = $"/api/v1/auth/roles/{roleId}/permissions";
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync(url);
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ using System.Text.Json;
|
||||
namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Admin.Authorization.Roles;
|
||||
|
||||
/// <summary>
|
||||
/// Contains security tests for the <c>/roles</c> route.
|
||||
/// Contains security tests for the <c>/auth/roles</c> route.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetRolesEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
@@ -34,7 +34,7 @@ public class GetRolesEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
public async Task GetRoles_WhenUnauthorized_ShouldReturnUnauthorizedResult()
|
||||
{
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/roles");
|
||||
HttpResponseMessage response = await _client.GetAsync("/api/v1/auth/roles");
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
|
||||
@@ -46,7 +46,7 @@ public class GetRolesEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
problemDetails!["status"].GetInt32().Should().Be(StatusCodes.Status401Unauthorized);
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc7235#section-3.1");
|
||||
problemDetails["title"].GetString().Should().Be("Unauthorized");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["detail"].GetString().Should().Be("Authentication failed");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -12,7 +12,7 @@ using System.Text.Json;
|
||||
namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Admin.Authorization.Roles;
|
||||
|
||||
/// <summary>
|
||||
/// Contains security tests for the <c>/roles</c> route.
|
||||
/// Contains security tests for the <c>/auth/roles</c> route.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
@@ -49,7 +49,7 @@ public class UpdateRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
);
|
||||
|
||||
// Act
|
||||
HttpResponseMessage response = await _client.PutAsync("/api/v1/roles", content);
|
||||
HttpResponseMessage response = await _client.PutAsync("/api/v1/auth/roles", content);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
|
||||
@@ -61,7 +61,7 @@ public class UpdateRoleEndpointTests : IClassFixture<LuminaApiFactory>
|
||||
problemDetails!["status"].GetInt32().Should().Be(StatusCodes.Status401Unauthorized);
|
||||
problemDetails["type"].GetString().Should().Be("https://tools.ietf.org/html/rfc7235#section-3.1");
|
||||
problemDetails["title"].GetString().Should().Be("Unauthorized");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/roles");
|
||||
problemDetails["instance"].GetProperty("value").GetString().Should().Be("/api/v1/auth/roles");
|
||||
problemDetails["detail"].GetString().Should().Be("Authentication failed");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user