Skip to content

Commit

Permalink
Test that different extraction outputs generate different fingerprints
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Nov 6, 2023
1 parent 5e205ef commit f76ee50
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_request_fingerprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,17 @@ def test_url_fragments(params, match):
assert fingerprint1 == fingerprint2
else:
assert fingerprint1 != fingerprint2


def test_autoextract():
crawler = get_crawler()
fingerprinter = create_instance(
ScrapyZyteAPIRequestFingerprinter, settings=crawler.settings, crawler=crawler
)
request1 = Request("https://toscrape.com", meta={"zyte_api": {"product": True}})
fingerprint1 = fingerprinter.fingerprint(request1)
request2 = Request(
"https://toscrape.com", meta={"zyte_api": {"productNavigation": True}}
)
fingerprint2 = fingerprinter.fingerprint(request2)
assert fingerprint1 != fingerprint2

0 comments on commit f76ee50

Please sign in to comment.