From 10309f517d4d1188d51695261a2becaa7e694d38 Mon Sep 17 00:00:00 2001 From: Samuel Wu Date: Wed, 28 Aug 2024 18:33:29 +0100 Subject: [PATCH] Lbxd scraper converted into a pytest --- backend/tests/test_lbxd_scraper.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/tests/test_lbxd_scraper.py b/backend/tests/test_lbxd_scraper.py index 8f94f82..1c23c41 100644 --- a/backend/tests/test_lbxd_scraper.py +++ b/backend/tests/test_lbxd_scraper.py @@ -1,3 +1,4 @@ +import pytest import sys import os import asyncio @@ -5,8 +6,14 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils import * -if __name__ == "__main__": - movies = [{'film_slug':'inland-empire'}, {'film_slug':'satantango'}, - {'film_slug':'sicily'}] - info = asyncio.run(scrape_movies(movies)) - print(info) \ No newline at end of file +@pytest.mark.asyncio +async def test_scrape_movies(): + username = "mscorsese" + expected_info = [ + { + 'film_slug': 'yeelen', + 'title': 'yeelen', + }, + ] + user_ratings = await scrape_user_ratings(username) + info = await scrape_movies(user_ratings, username=username) \ No newline at end of file