diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7f8aadc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Run sanity check + +on: + push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: 3.11 + - name: Set PYTHONPATH + run: echo "PYTHONPATH=/home/runner/work/CU-GIR/CU-GIR" >> $GITHUB_ENV + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install stix2==3.0.1 pytest + - name: Test with pytest + run: | + pytest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de2bf1d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +tests/__pycache__ diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_sanity.py b/tests/test_sanity.py new file mode 100644 index 0000000..04273ab --- /dev/null +++ b/tests/test_sanity.py @@ -0,0 +1,17 @@ +import json +import os + +import pytest +from stix2 import parse + + +HERE = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(HERE, "..", "STIX", "Current", "intel471_cu-gir.json")) as fh: + girs = json.load(fh) + + +@pytest.mark.parametrize("gir", girs) +def test_sanity(gir): + parse(gir, allow_custom=True) + +