Exemplo n.º 1
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()
Exemplo n.º 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()
Exemplo n.º 3
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()
Exemplo n.º 4
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()
Exemplo n.º 5
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()
Exemplo n.º 6
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()
Exemplo n.º 7
0
 def test_rel_with_non_rel_type(self):
     docuri = mock.Mock(type='highwire-pdf')
     presenter = DocumentURIJSONPresenter(docuri)
     assert presenter.rel is None
Exemplo n.º 8
0
 def test_rel_with_type_rel(self):
     docuri = mock.Mock(type='rel-canonical')
     presenter = DocumentURIJSONPresenter(docuri)
     assert 'canonical' == presenter.rel