mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-19 13:03:44 +00:00
Add maxPerPage to ORM (#3016)
* Add support for maxPerPage in OMR * Fix small bug
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using System.Net;
|
||||
using System;
|
||||
using System.Net;
|
||||
using FluentAssertions;
|
||||
using IntegrationTests.Fakes;
|
||||
using Microsoft.OneFuzz.Service;
|
||||
using Microsoft.OneFuzz.Service.Functions;
|
||||
@ -50,4 +52,32 @@ public abstract class AgentCommandsTestsBase : FunctionTestBase {
|
||||
var result = await func.Run(TestHttpRequestData.Empty("GET"));
|
||||
Assert.Equal(HttpStatusCode.BadRequest, result.StatusCode); // BadRequest due to no body, not Unauthorized
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Async.Task AgentCommand_GetsCommand() {
|
||||
var machineId = Guid.NewGuid();
|
||||
var messageId = Guid.NewGuid().ToString();
|
||||
var command = new NodeCommand {
|
||||
Stop = new StopNodeCommand()
|
||||
};
|
||||
await Context.InsertAll(new[] {
|
||||
new NodeMessage (
|
||||
machineId,
|
||||
messageId,
|
||||
command
|
||||
),
|
||||
});
|
||||
|
||||
var commandRequest = new NodeCommandGet(machineId);
|
||||
var auth = new TestEndpointAuthorization(RequestType.Agent, Logger, Context);
|
||||
var func = new AgentCommands(Logger, auth, Context);
|
||||
|
||||
var result = await func.Run(TestHttpRequestData.FromJson("GET", commandRequest));
|
||||
Assert.Equal(HttpStatusCode.OK, result.StatusCode);
|
||||
|
||||
var pendingNodeCommand = BodyAs<PendingNodeCommand>(result);
|
||||
pendingNodeCommand.Envelope.Should().NotBeNull();
|
||||
pendingNodeCommand.Envelope?.Command.Should().BeEquivalentTo(command);
|
||||
pendingNodeCommand.Envelope?.MessageId.Should().Be(messageId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user