Test get document

Initial tests for get_document_or_404 as suggested in #4760