feat(cosmetics): route ownership checks + shop owned-flags through entitlements (freeplay)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-29 14:36:50 -04:00
parent d68a85bbc5
commit 302bf17c31
3 changed files with 61 additions and 12 deletions

View File

@@ -123,4 +123,27 @@ public class LeaderSkinControllerTests
var resp = await client.PostAsync("/leader_skin/set", JsonBody(json));
Assert.That((int)resp.StatusCode, Is.EqualTo(501));
}
[Test]
public async Task Set_freeplay_allows_equipping_unowned_skin()
{
using var factory = new SVSimTestFactory();
await factory.SeedGlobalsAsync();
long viewerId = await factory.SeedViewerAsync();
await factory.EnableFreeplayAsync();
int classId, skinId;
using (var scope = factory.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
var skin = await db.LeaderSkins.FirstAsync(s => s.ClassId != null);
skinId = skin.Id; classId = skin.ClassId!.Value;
}
using var client = factory.CreateAuthenticatedClient(viewerId);
var json = $$"""{"viewer_id":"0","steam_id":0,"steam_session_ticket":"","class_id":{{classId}},"leader_skin_id":{{skinId}},"is_random_leader_skin":false,"leader_skin_id_list":[]}""";
var resp = await client.PostAsync("/leader_skin/set", new StringContent(json, System.Text.Encoding.UTF8, "application/json"));
Assert.That(resp.StatusCode, Is.EqualTo(System.Net.HttpStatusCode.OK), await resp.Content.ReadAsStringAsync());
}
}