forked from xiongyuxing/tiku-backend.net
perf: optimize authorization scoreline and workers
This commit is contained in:
@@ -16,8 +16,8 @@ namespace Tiku.IntegrationTests.Api;
|
||||
|
||||
public sealed class AuthorizationManifestTests
|
||||
{
|
||||
private const int ExpectedActionCount = 381;
|
||||
private const string ExpectedSha256 = "0846541f337a32d7ff13f0e0a29eaa17c2e4b7f90c8d6813c977a1855776bab3";
|
||||
private const int ExpectedActionCount = 382;
|
||||
private const string ExpectedSha256 = "a1ca69bc9cfa439d5df1a456e60ba2f6b1f1baf1cca22e5a28be04a774682bb1";
|
||||
|
||||
[Fact]
|
||||
public void Controller_authorization_surface_matches_reviewed_manifest()
|
||||
|
||||
@@ -74,6 +74,31 @@ public sealed class ScorelineEndpointTests
|
||||
var item = json.RootElement.GetProperty("items").EnumerateArray().Single();
|
||||
Assert.Equal(2026, item.GetProperty("year").GetInt32());
|
||||
Assert.Equal(420, item.GetProperty("fieldValues").GetProperty("cultureScore").GetInt32());
|
||||
|
||||
using var firstCursorResponse = await client.GetAsync(
|
||||
$"/api/scoreline/records/cursor?tenantCode={tenantCode}®ionId={regionId}&pageSize=1");
|
||||
var firstCursorJson = await ReadJsonAsync(firstCursorResponse);
|
||||
Assert.Equal(HttpStatusCode.OK, firstCursorResponse.StatusCode);
|
||||
Assert.True(firstCursorJson.RootElement.GetProperty("hasMore").GetBoolean());
|
||||
var firstCursorItem = firstCursorJson.RootElement.GetProperty("items").EnumerateArray().Single();
|
||||
var firstCursorId = firstCursorItem.GetProperty("id").GetGuid();
|
||||
var nextCursor = firstCursorJson.RootElement.GetProperty("nextCursor").GetString();
|
||||
Assert.False(string.IsNullOrWhiteSpace(nextCursor));
|
||||
|
||||
using var secondCursorResponse = await client.GetAsync(
|
||||
$"/api/scoreline/records/cursor?tenantCode={tenantCode}®ionId={regionId}&pageSize=1&cursor={Uri.EscapeDataString(nextCursor!)}");
|
||||
var secondCursorJson = await ReadJsonAsync(secondCursorResponse);
|
||||
Assert.Equal(HttpStatusCode.OK, secondCursorResponse.StatusCode);
|
||||
Assert.False(secondCursorJson.RootElement.GetProperty("hasMore").GetBoolean());
|
||||
var secondCursorItem = secondCursorJson.RootElement.GetProperty("items").EnumerateArray().Single();
|
||||
Assert.NotEqual(firstCursorId, secondCursorItem.GetProperty("id").GetGuid());
|
||||
Assert.Equal(2025, secondCursorItem.GetProperty("year").GetInt32());
|
||||
|
||||
using var invalidCursorResponse = await client.GetAsync(
|
||||
$"/api/scoreline/records/cursor?tenantCode={tenantCode}®ionId={regionId}&cursor=not-a-cursor");
|
||||
var invalidCursorJson = await ReadJsonAsync(invalidCursorResponse);
|
||||
Assert.Equal(HttpStatusCode.BadRequest, invalidCursorResponse.StatusCode);
|
||||
Assert.Equal("scoreline_cursor_invalid", invalidCursorJson.RootElement.GetProperty("code").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user