Ejemplo n.º 1
0
    public async Async.Task AgentAuthorization_IsAccepted()
    {
        var auth = new TestEndpointAuthorization(RequestType.Agent, Logger, Context);
        var func = new AgentCanSchedule(Logger, auth, Context);

        var result = await func.Run(TestHttpRequestData.Empty("POST"));

        Assert.Equal(HttpStatusCode.BadRequest, result.StatusCode); // BadRequest due to no body, not Unauthorized
    }
Ejemplo n.º 2
0
    public async Async.Task UserAuthorization_IsNotPermitted()
    {
        var auth = new TestEndpointAuthorization(RequestType.User, Logger, Context);
        var func = new AgentCanSchedule(Logger, auth, Context);

        var result = await func.Run(TestHttpRequestData.Empty("POST"));

        Assert.Equal(HttpStatusCode.Unauthorized, result.StatusCode);
    }