WIP: Fix EZP-20530 incomplete unit & integration tests

This PR fixes https://jira.ez.no/browse/EZP-20530