public async Task AsRegularUser_Returns403Forbidden() { using var client = await _fixture.BuildClient(); await _fixture.AuthorizeAsRegularUser(client); var result = await client.GetAsync(Routes.v1.Editions.Index); Assert.Equal(System.Net.HttpStatusCode.Forbidden, result.StatusCode); var problemDetails = System.Text.Json.JsonSerializer.Deserialize <ProblemDetails>(await result.Content.ReadAsStringAsync()); Assert.Equal("https://httpstatuses.com/403", problemDetails.Type); }
public async Task AsRegularUser_FailsWith403Forbidden() { using var client = await _fixture.BuildClient(); await _fixture.AuthorizeAsRegularUser(client); var result = await client.PostAsJsonAsync(Routes.v1.Editions.Create, new CreateUseCase.Command() { Name = "test", StartDate = DateTime.Today, EndDate = DateTime.Today.AddDays(7) }); Assert.Equal(System.Net.HttpStatusCode.Forbidden, result.StatusCode); var problemDetails = System.Text.Json.JsonSerializer.Deserialize <ProblemDetails>(await result.Content.ReadAsStringAsync()); Assert.Equal("https://httpstatuses.com/403", problemDetails.Type); }