diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..c3b46e0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,25 @@ +name: test index +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install reqs + run: | + pip install --upgrade pip + pip install --upgrade setuptools wheel + pip install pytest validators + - name: Run tests + run: pytest -vv \ No newline at end of file diff --git a/.gitignore b/.gitignore index b0a5122..f6a44d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ env/* +__pycache__/ diff --git a/test_index.py b/test_index.py new file mode 100644 index 0000000..4931142 --- /dev/null +++ b/test_index.py @@ -0,0 +1,15 @@ +import json +import validators + +def test_index(): + with open("index.json") as f: + index = json.load(f) + + names = [] + for i in index: + assert validators.url(i["download_url"]) + assert i["download_url"].startswith("https://raw.githubusercontent.com/amidaware/reporting-templates/master") + names.append(i["name"]) + + # make sure names are all unique + assert len(names) == len(set(names)) \ No newline at end of file