def test_it_sets_correct_content_type(self, AnnotationJSONLDPresenter, pyramid_request): AnnotationJSONLDPresenter.CONTEXT_URL = 'http://foo.com/context.jsonld' annotation = mock.Mock() views.read_jsonld(annotation, pyramid_request) assert pyramid_request.response.content_type == 'application/ld+json' assert pyramid_request.response.content_type_params == { 'profile': 'http://foo.com/context.jsonld' }
def test_it_returns_presented_annotation(self, AnnotationJSONLDPresenter, pyramid_request): context = mock.Mock() presenter = mock.Mock() AnnotationJSONLDPresenter.return_value = presenter AnnotationJSONLDPresenter.CONTEXT_URL = 'http://foo.com/context.jsonld' result = views.read_jsonld(context, pyramid_request) AnnotationJSONLDPresenter.assert_called_once_with(context) assert result == presenter.asdict()
def test_it_returns_presented_annotation(self, AnnotationJSONLDPresenter, links_service, pyramid_request): annotation = mock.Mock() presenter = mock.Mock() AnnotationJSONLDPresenter.return_value = presenter AnnotationJSONLDPresenter.CONTEXT_URL = 'http://foo.com/context.jsonld' result = views.read_jsonld(annotation, pyramid_request) AnnotationJSONLDPresenter.assert_called_once_with(annotation, links_service) assert result == presenter.asdict()