diff --git a/apps/windows_agent/tests/TermRemoteCtl.Agent.IntegrationTests/Api/PairingEndpointsTests.cs b/apps/windows_agent/tests/TermRemoteCtl.Agent.IntegrationTests/Api/PairingEndpointsTests.cs index b8a9b85..a2a4a68 100644 --- a/apps/windows_agent/tests/TermRemoteCtl.Agent.IntegrationTests/Api/PairingEndpointsTests.cs +++ b/apps/windows_agent/tests/TermRemoteCtl.Agent.IntegrationTests/Api/PairingEndpointsTests.cs @@ -52,6 +52,23 @@ public sealed class PairingEndpointsTests Assert.Equal("rejected", payload.Status); } + [Fact] + public async Task Redeem_Returns_BadRequest_When_Request_Body_Is_Empty() + { + await using var fixture = new PairingApiFixture(); + using var client = fixture.CreateClient(); + using var content = new StringContent(string.Empty, Encoding.UTF8, "application/json"); + + using var response = await client.PostAsync("/api/pairing/redeem", content); + var payload = await response.Content.ReadFromJsonAsync(); + + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.NotNull(payload); + Assert.False(payload.Success); + Assert.Equal("invalid_request", payload.ErrorCode); + Assert.Equal("rejected", payload.Status); + } + [Fact] public async Task CreateCode_Does_Not_Write_Secret_Code_To_Audit_Log() {