diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 73161d3..c7ba739 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -22,6 +22,30 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: Run image + uses: abatilo/actions-poetry@v2 + + - uses: actions/cache@v3 + name: Define a cache for the virtual environment based on the dependencies lock file + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + + - name: Install the project dependencies + run: poetry install + + - name: Run tests + run: poetry run pytest -v + build: runs-on: ubuntu-latest permissions: diff --git a/tests/main_test.py b/tests/main_test.py new file mode 100644 index 0000000..421fb87 --- /dev/null +++ b/tests/main_test.py @@ -0,0 +1,18 @@ +import pytest + +from main import read_item +from src.models.requests import LinkRequest + +test_websites = [ + "https://ext.to/", + "https://btmet.com/", + "https://extratorrent.st/", + "https://idope.se/", +] +pytest_plugins = ("pytest_asyncio",) + + +@pytest.mark.parametrize("website", test_websites) +@pytest.mark.asyncio +async def test_bypass(website: str): + await read_item(LinkRequest(url=website, maxTimeout=5, cmd="")) diff --git a/tests/test_browser.py b/tests/test_browser.py deleted file mode 100644 index f4f5361..0000000 --- a/tests/test_browser.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_dummy(): - assert True