Skip to content

Commit

Permalink
Add BFM tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VeNoMouS committed Jan 7, 2021
1 parent 19c66b5 commit afc39f0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/fixtures/bfm_07_01_2021.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html>
<head>
<script async src='/cdn-cgi/bm/cv/664825181/api.js'></script></head>
<body>
<script type="text/javascript">(function(){window['__CF$cv$params']={r:'60aada8e9833a421',m:'532f79b4896bc645e9bc65c082233d366c463167-1610003371-1800-AaUcOdgPEvHnE/6BXwWR92GHTaQB+CpDC/GmpduICVl1SqIqO/hxVKypTcm5PWLp08VPOfjoGNJpBE3jDOOnqqeK25pGoxHijE9l15LHOOnogPsEgt9hwRDRRbKSsp2eDw==',s:[0xf36691842f,0xba40715075],}})();</script></body>
</html>

16 changes: 16 additions & 0 deletions tests/test_cloudscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ def test_reCaptcha_providers(self, **kwargs):
)
scraper.get(url)

# ------------------------------------------------------------------------------- #
# test BFM detection

@mockCloudflare(fixture='bfm_07_01_2021.html', payload={})
def test_bfm_07_01_2021(self, **kwargs):
scraper = cloudscraper.create_scraper(delay=0.1)
assert scraper.is_BFM_Challenge(scraper.get(url))

# ------------------------------------------------------------------------------- #
# test no BFM detection

@mockCloudflare(fixture='js_challenge-27-05-2020.html', payload={})
def test_not_bfm_07_01_2021(self, **kwargs):
scraper = cloudscraper.create_scraper(delay=0.1)
assert not scraper.is_BFM_Challenge(scraper.get(url))

# ------------------------------------------------------------------------------- #

def test_helper(self, **kwargs):
Expand Down

0 comments on commit afc39f0

Please sign in to comment.