def test_expand_uri_document_uris(self, db_session): document = Document(document_uris=[ DocumentURI(uri='http://foo.com/', claimant='http://bar.com'), DocumentURI(uri='http://bar.com/', claimant='http://bar.com'), ]) db_session.add(document) db_session.flush() assert storage.expand_uri(db_session, 'http://foo.com/') == [ 'http://foo.com/', 'http://bar.com/' ]
def test_expand_uri_document_uris(self, db_session): document = Document(document_uris=[ DocumentURI(uri="http://foo.com/", claimant="http://bar.com"), DocumentURI(uri="http://bar.com/", claimant="http://bar.com"), ]) db_session.add(document) db_session.flush() assert storage.expand_uri(db_session, "http://foo.com/") == [ "http://foo.com/", "http://bar.com/", ]
def test_expand_uri_document_doesnt_expand_canonical_uris(self, db_session): document = Document(document_uris=[ DocumentURI(uri='http://foo.com/', claimant='http://example.com'), DocumentURI(uri='http://bar.com/', claimant='http://example.com'), DocumentURI(uri='http://example.com/', type='rel-canonical', claimant='http://example.com'), ]) db_session.add(document) db_session.flush() assert storage.expand_uri(db_session, "http://example.com/") == [ "http://example.com/"]
def test_expand_uri_document_uris(self, db_session, normalized, expected_uris): document = Document(document_uris=[ DocumentURI(uri="http://example.com/", claimant="http://example.com"), DocumentURI(uri="http://alt.example.com/", claimant="http://example.com"), ]) db_session.add(document) db_session.flush() uris = storage.expand_uri(db_session, "http://alt.example.com/", normalized=normalized) assert uris == expected_uris
def test_expand_uri_document_doesnt_expand_canonical_uris( self, db_session, normalized, expected_uris): document = Document(document_uris=[ DocumentURI( uri="http://example.com/", type="rel-canonical", claimant="http://example.com", ), DocumentURI(uri="http://noise.example.com/", claimant="http://example.com"), ]) db_session.add(document) db_session.flush() uris = storage.expand_uri(db_session, "http://example.com/", normalized=normalized) assert uris == expected_uris