Metadata-Version: 2.4
Name: ton-devtools-pytest
Version: 0.1.0
Summary: pytest plugin providing declarative fixtures for ICP integration testing
Project-URL: Homepage, https://github.com/ismaildalgatov/ton-devtools
Project-URL: Repository, https://github.com/ismaildalgatov/ton-devtools
Project-URL: Documentation, https://ismaildalgatov.github.io/ton-devtools/
Project-URL: Bug Tracker, https://github.com/ismaildalgatov/ton-devtools/issues
Project-URL: Changelog, https://github.com/ismaildalgatov/ton-devtools/blob/main/packages/ton-devtools-pytest/CHANGELOG.md
License: MIT
License-File: LICENSE
Keywords: blockchain,fixtures,icp,pytest,testing,ton
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic<3,>=2.7
Requires-Dist: pyjwt>=2.8
Requires-Dist: pytest-asyncio>=0.24
Requires-Dist: pytest>=8.3
Requires-Dist: ton-devtools-auth-sdk>=0.1.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# ton-devtools-pytest

> pytest plugin for declarative ICP integration testing.

Part of the [ton-devtools](https://github.com/ismaildalgatov/ton-devtools) monorepo.

[![PyPI](https://img.shields.io/pypi/v/ton-devtools-pytest)](https://pypi.org/project/ton-devtools-pytest/)
[![Python](https://img.shields.io/pypi/pyversions/ton-devtools-pytest)](https://pypi.org/project/ton-devtools-pytest/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

## What it does

Auto-registered pytest plugin that hides all ICP authentication boilerplate
behind declarative fixtures:

- `icp_harness` — generates wallets, signs proofs, issues JWTs in one call
- `icp_strict_mode` — enforces TRMC security policies, fails on violations
- `MockWallet` — real ed25519 keypair, produces valid TON Connect 2.0 proofs

## Installation

```bash
pip install ton-devtools-pytest
```

The plugin registers automatically via the `pytest11` entry point.
No `conftest.py` configuration required.

## Quick Start

```python
from ton_devtools_pytest.asserts import assert_authenticated

async def test_profile_read(icp_harness):
    user = icp_harness.create_mock_user(roles=["user"])
    resp = await icp_harness.client.get("/me/profile")
    assert resp.status_code == 200

async def test_high_risk_blocked(icp_strict_mode):
    user = icp_strict_mode.create_mock_user(risk_score="high")
    resp = await icp_strict_mode.client.post("/proposals", json={...})
    icp_strict_mode.assert_no_high_risk_pass(resp)
```

## CLI options

```bash
pytest --icp-base-url=http://localhost:8000 --icp-jwt-secret=your-secret
```

Or via environment variables: `ICP_BASE_URL`, `ICP_JWT_SECRET`.

## License

MIT
