Testing Linkedin Dropin for Antibot

This commit is contained in:
msramalho
2025-06-11 16:52:03 +01:00
parent 2adcf231f7
commit f5be7a50c1
2 changed files with 32 additions and 2 deletions

View File

@@ -1,6 +1,10 @@
# reddit test credentials
# ANTIBOT reddit test credentials
REDDIT_TEST_USERNAME=""
REDDIT_TEST_PASSWORD=""
# ANTIBOT linkedin test credentials
LINKEDIN_TEST_USERNAME=""
LINKEDIN_TEST_PASSWORD=""
# twitter test credentials
TWITTER_BEARER_TOKEN="TEST_KEY"

View File

@@ -41,7 +41,11 @@ class TestAntibotExtractorEnricher(TestExtractorBase):
"reddit.com": {
"username": os.environ.get("REDDIT_TEST_USERNAME"),
"password": os.environ.get("REDDIT_TEST_PASSWORD"),
}
},
"linkedin.com": {
"username": os.environ.get("LINKEDIN_TEST_USERNAME"),
"password": os.environ.get("LINKEDIN_TEST_PASSWORD"),
},
},
}
@@ -148,6 +152,28 @@ class TestAntibotExtractorEnricher(TestExtractorBase):
):
self.test_download_pages_with_media(setup_module, make_item, url, in_title, in_text, image_count, video_count)
@pytest.mark.skipif(
not os.environ.get("REDDIT_TEST_USERNAME") or not os.environ.get("REDDIT_TEST_PASSWORD"),
reason="No Reddit test credentials provided",
)
@pytest.mark.download
@pytest.mark.parametrize(
"url,in_title,in_text,image_count,video_count",
[
(
"https://www.linkedin.com/posts/bellingcat_live-podcast-bellingcat-activity-7331725631799398400-xocM/",
"Post",
"It takes time to go from hunch to reporting...",
2,
0,
),
],
)
def test_linkedin_download_with_login(
self, setup_module, make_item, url, in_title, in_text, image_count, video_count
):
self.test_download_pages_with_media(setup_module, make_item, url, in_title, in_text, image_count, video_count)
@pytest.mark.download
@pytest.mark.parametrize(
"url,in_html",