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_sets_correct_content_type(self, AnnotationJSONLDPresenter): AnnotationJSONLDPresenter.CONTEXT_URL = 'http://foo.com/context.jsonld' annotation = mock.Mock() request = testing.DummyRequest() views.read_jsonld(annotation, request) assert request.response.content_type == 'application/ld+json' assert request.response.content_type_params == { 'profile': 'http://foo.com/context.jsonld' }
def test_it_returns_presented_annotation(self, AnnotationJSONLDPresenter, 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(pyramid_request, annotation) assert result == presenter.asdict()
def test_it_returns_presented_annotation(self, AnnotationJSONLDPresenter): annotation = mock.Mock() presenter = mock.Mock() AnnotationJSONLDPresenter.return_value = presenter AnnotationJSONLDPresenter.CONTEXT_URL = 'http://foo.com/context.jsonld' request = testing.DummyRequest() result = views.read_jsonld(annotation, request) AnnotationJSONLDPresenter.assert_called_once_with(request, annotation) assert result == presenter.asdict()