Spec at docs/api-spec/endpoints/post-login/download_time-{start,end}.md
already documented both endpoints fully against the decompiled
Wizard/DownloadStartTask.cs and Wizard/DownloadFinishTask.cs — the
controller side was the gap.
The client fires /download_time/start before kicking off an Akamai
asset bundle download and /download_time/end on completion. Both are
pure telemetry from our perspective. When NukeIdentityOnStartup wipes
PlayerPrefs broadly (the pre-narrow loader behaviour), the client
decides it needs to download tutorial assets, calls /download_time/start,
and a 404 there surfaces as an HTTP error popup before the download
proceeds. Stubbing with empty data:{} bodies plus result_code:1 is the
documented minimum-viable response.
Acts as belt-and-suspenders against the narrow IdentityWipe (which
preserves the cache index so downloads shouldn't trigger) ever being
bypassed by a different code path.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System.Net;
|
|
using System.Text;
|
|
using System.Text.Json;
|
|
using NUnit.Framework;
|
|
using SVSim.UnitTests.Infrastructure;
|
|
|
|
namespace SVSim.UnitTests.Controllers;
|
|
|
|
public class DownloadTimeControllerTests
|
|
{
|
|
[TestCase("/download_time/start")]
|
|
[TestCase("/download_time/end")]
|
|
public async Task Returns_200_with_empty_data_object(string path)
|
|
{
|
|
using var factory = new SVSimTestFactory();
|
|
long viewerId = await factory.SeedViewerAsync();
|
|
using var client = factory.CreateAuthenticatedClient(viewerId);
|
|
|
|
var requestJson = """{"viewer_id":"0","steam_id":0,"steam_session_ticket":""}""";
|
|
|
|
var response = await client.PostAsync(path,
|
|
new StringContent(requestJson, Encoding.UTF8, "application/json"));
|
|
|
|
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK),
|
|
await response.Content.ReadAsStringAsync());
|
|
|
|
using var doc = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
|
|
Assert.That(doc.RootElement.ValueKind, Is.EqualTo(JsonValueKind.Object));
|
|
Assert.That(doc.RootElement.EnumerateObject().Count(), Is.EqualTo(0),
|
|
"Spec calls for empty `data: {}` — DownloadStartTask's optional image_type stays " +
|
|
"absent, DownloadFinishTask doesn't read data at all.");
|
|
}
|
|
}
|