diff --git a/tests/.env.test.example b/tests/.env.test.example index 2e058ab..367d3f5 100644 --- a/tests/.env.test.example +++ b/tests/.env.test.example @@ -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" \ No newline at end of file diff --git a/tests/extractors/test_antibot_extractor_enricher.py b/tests/extractors/test_antibot_extractor_enricher.py index 642d0ec..516357e 100644 --- a/tests/extractors/test_antibot_extractor_enricher.py +++ b/tests/extractors/test_antibot_extractor_enricher.py @@ -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",