Add user_agent is_bot tests

This commit is contained in:
rubenwardy 2024-05-24 16:11:25 +01:00
parent a3371d538c
commit 8815327257
2 changed files with 13 additions and 1 deletions

@ -17,5 +17,17 @@
import user_agents
def test_web_is_not_bot():
assert not user_agents.parse("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0").is_bot
assert not user_agents.parse("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/125.0.0.0 Safari/537.36").is_bot
def test_minetest_is_not_bot():
assert not user_agents.parse("Minetest/5.5.1 (Linux/4.14.193+-ab49821 aarch64)").is_bot
def test_crawlers_are_bots():
assert user_agents.parse("Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, "
"like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; Googlebot/2.1; "
"+http://www.google.com/bot.html)").is_bot

@ -56,7 +56,7 @@ pytz==2024.1
PyYAML==6.0.1
redis==5.0.4
requests==2.32.2
sentry-sdk==2.3.1
sentry-sdk[flask]==2.3.1
six==1.16.0
smmap==5.0.1
soupsieve==2.5