test(acl): cover ListZaaktypenAsync gateway read (mutation ratchet) (refs #130)
CI / mutation (pull_request) Successful in 8m44s
CI / verify-stack (pull_request) Failing after 18m24s
CI / build (pull_request) Failing after 1m32s
CI / lint (pull_request) Successful in 1m48s
CI / unit (pull_request) Failing after 1m48s
CI / frontend (pull_request) Successful in 4m29s
CI / mutation (pull_request) Successful in 8m44s
CI / verify-stack (pull_request) Failing after 18m24s
CI / build (pull_request) Failing after 1m32s
CI / lint (pull_request) Successful in 1m48s
CI / unit (pull_request) Failing after 1m48s
CI / frontend (pull_request) Successful in 4m29s
This commit is contained in:
@@ -824,4 +824,51 @@ public class OpenZaakGatewayTests
|
|||||||
await Assert.ThrowsAnyAsync<ArgumentException>(() => Gateway(handler).ResolveZaaktypeUrlAsync(" "));
|
await Assert.ThrowsAnyAsync<ArgumentException>(() => Gateway(handler).ResolveZaaktypeUrlAsync(" "));
|
||||||
await Assert.ThrowsAnyAsync<ArgumentException>(() => Gateway(handler).ResolveInformatieobjecttypeUrlAsync(" "));
|
await Assert.ThrowsAnyAsync<ArgumentException>(() => Gateway(handler).ResolveInformatieobjecttypeUrlAsync(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Listing_zaaktypen_queries_published_zaaktypen_and_maps_them(/* S-15a */)
|
||||||
|
{
|
||||||
|
HttpRequestMessage? seen = null;
|
||||||
|
var handler = new StubHandler(req =>
|
||||||
|
{
|
||||||
|
seen = req;
|
||||||
|
const string json = """
|
||||||
|
{"results":[
|
||||||
|
{"url":"http://openzaak/catalogi/api/v1/zaaktypen/big","identificatie":"BIG-REGISTRATIE","omschrijving":"BIG-registratie"},
|
||||||
|
{"url":"http://openzaak/catalogi/api/v1/zaaktypen/her","identificatie":"BIG-HERREGISTRATIE","omschrijving":"BIG-herregistratie"}
|
||||||
|
]}
|
||||||
|
""";
|
||||||
|
return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
Content = new StringContent(json, Encoding.UTF8, "application/json"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var zaaktypen = await Gateway(handler).ListZaaktypenAsync();
|
||||||
|
|
||||||
|
// Only the published zaaktypen collection is queried (status=definitief excludes concepts).
|
||||||
|
Assert.Contains("/catalogi/api/v1/zaaktypen", seen!.RequestUri!.ToString());
|
||||||
|
Assert.Contains("status=definitief", seen.RequestUri!.ToString());
|
||||||
|
// Authenticated like the other catalogi reads.
|
||||||
|
Assert.Equal("Bearer", seen.Headers.Authorization!.Scheme);
|
||||||
|
// Each result maps to a public-safe summary (identificatie + omschrijving + url).
|
||||||
|
Assert.Equal(2, zaaktypen.Count);
|
||||||
|
Assert.Equal("BIG-REGISTRATIE", zaaktypen[0].Identificatie);
|
||||||
|
Assert.Equal("BIG-registratie", zaaktypen[0].Omschrijving);
|
||||||
|
Assert.Equal(new Uri("http://openzaak/catalogi/api/v1/zaaktypen/big"), zaaktypen[0].Url);
|
||||||
|
Assert.Equal("BIG-HERREGISTRATIE", zaaktypen[1].Identificatie);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Listing_zaaktypen_returns_empty_when_the_catalogus_has_none()
|
||||||
|
{
|
||||||
|
var handler = new StubHandler(_ => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
Content = new StringContent("""{"results":[]}""", Encoding.UTF8, "application/json"),
|
||||||
|
}));
|
||||||
|
|
||||||
|
var zaaktypen = await Gateway(handler).ListZaaktypenAsync();
|
||||||
|
|
||||||
|
Assert.Empty(zaaktypen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user