Пример #1
0
    def test_asdict_empty_rel(self):
        docuri = mock.Mock(uri='http://example.com',
                           type='dc-doi',
                           content_type='text/html')
        presenter = DocumentURIJSONPresenter(docuri)

        expected = {'href': 'http://example.com', 'type': 'text/html'}

        assert expected == presenter.asdict()
Пример #2
0
    def test_asdict_empty_type(self):
        docuri = mock.Mock(uri='http://example.com',
                           type='rel-canonical',
                           content_type=None)
        presenter = DocumentURIJSONPresenter(docuri)

        expected = {'href': 'http://example.com', 'rel': 'canonical'}

        assert expected == presenter.asdict()
Пример #3
0
    def test_asdict(self):
        docuri = mock.Mock(uri='http://example.com/site.pdf',
                           type='rel-alternate',
                           content_type='application/pdf')
        presenter = DocumentURIJSONPresenter(docuri)

        expected = {
            'href': 'http://example.com/site.pdf',
            'rel': 'alternate',
            'type': 'application/pdf'
        }

        assert expected == presenter.asdict()
Пример #4
0
 def test_rel_with_non_rel_type(self):
     docuri = mock.Mock(type='highwire-pdf')
     presenter = DocumentURIJSONPresenter(docuri)
     assert presenter.rel is None
Пример #5
0
 def test_rel_with_type_rel(self):
     docuri = mock.Mock(type='rel-canonical')
     presenter = DocumentURIJSONPresenter(docuri)
     assert 'canonical' == presenter.rel