| import asyncio | |
| import pytest | |
| from vsp.app.scrapers.linkedin_downloader import LinkedinDownloader | |
| from vsp.shared import logger_factory | |
| logger = logger_factory.get_logger(__name__) | |
| async def test_fetch_linkedin_data_integration(): | |
| """ | |
| Integration test for LinkedinDownloader. | |
| This test makes an actual network request to fetch the Linkedin profile of 'navkast'. | |
| It requires a valid RapidAPI key to be set in the AWS Parameter Store. | |
| Note: This test should be run sparingly to avoid unnecessary API calls and potential rate limiting. | |
| """ | |
| downloader = LinkedinDownloader() | |
| linkedin_url = "https://www.linkedin.com/in/navkast/" | |
| try: | |
| profile = await downloader.fetch_linkedin_data(linkedin_url) | |
| # Log the fetched profile data | |
| logger.info("Fetched Linkedin profile", first_name=profile.first_name, last_name=profile.last_name) | |
| # Assertions to verify the fetched data | |
| assert profile.first_name == "Naveen" | |
| assert profile.last_name == "K." | |
| assert "University of Pennsylvania" in [edu.school_name for edu in profile.educations] | |
| logger.info("Integration test passed successfully") | |
| except Exception as e: | |
| logger.error("Integration test failed", error=str(e)) | |
| raise | |
| if __name__ == "__main__": | |
| asyncio.run(test_fetch_linkedin_data_integration()) | |