Skip to main content

Shared test factory package for IIL Platform Django repos

Project description

iil-testkit

Shared test factory package for all IIL Platform Django repositories.

Installation

pip install "iil-testkit[smoke]>=0.4.0,<1"

Features

  • Fixtures: auth_client, staff_client, api_client, db_user, staff_user, admin_user
  • Assertions: assert_htmx_response, assert_data_testids, assert_redirects_to_login, assert_no_n_plus_one, assert_form_error
  • Smoke Testing: discover_smoke_urls() — auto-discovers all parameterless Django views
  • ADR-048 Enforcement: assert_data_testids() — verifies all hx-* elements have data-testid
  • Naming Convention: Auto-enforces test_should_* prefix (ADR-057)

Quick Start

# tests/conftest.py
pytest_plugins = ["iil_testkit.fixtures"]

# tests/test_views_smoke.py
import pytest
from iil_testkit.smoke import discover_smoke_urls

_SMOKE_URLS: list[str] = discover_smoke_urls()

@pytest.mark.parametrize("url", _SMOKE_URLS)
@pytest.mark.django_db
def test_should_view_return_200(url: str, auth_client) -> None:
    response = auth_client.get(url)
    assert response.status_code in (200, 302)

Scaffold Generator

python3 platform/scripts/gen_test_scaffold.py <repo-name>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iil_testkit-0.4.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iil_testkit-0.4.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file iil_testkit-0.4.0.tar.gz.

File metadata

  • Download URL: iil_testkit-0.4.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for iil_testkit-0.4.0.tar.gz
Algorithm Hash digest
SHA256 06caf99593980b13bafbc650a6a2baa993f34086c4cc963e767608ecc244b42c
MD5 67ccf479e684a2ec31749993fa68743a
BLAKE2b-256 c0c578a1d24cd1451e94ce54f9d99b451b1ad57430204b142ae27122f1b8e81b

See more details on using hashes here.

File details

Details for the file iil_testkit-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: iil_testkit-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for iil_testkit-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a201eafd534162f3bb1005686cd1db15ee698b79c95443f884ddb35d85639d2
MD5 56e03dd2c69cce759dce8ea9eeeccc43
BLAKE2b-256 58e31f7ac68267e1e6d6bc773fe23575c1d6d99b25418c11d8825f12eea9dc46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page