mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16: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
+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