Skip to main content

ton-devtools-pytest

pytest plugin for declarative ICP integration testing.

Part of the ton-devtools monorepo.

PyPI Python License: MIT

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

pip install ton-devtools-pytest

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

Quick Start

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

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

Or via environment variables: ICP_BASE_URL, ICP_JWT_SECRET.

License

MIT

Metadata

Release files for ton-devtools-pytest 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ton-devtools-pytest 0.1.0
File Size Uploaded
ton_devtools_pytest-0.1.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ton-devtools-pytest 0.1.0
File Interpreter ABI Platform
ton_devtools_pytest-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.8 kB

Release files / ton_devtools_pytest-0.1.0.tar.gz

Download URL ton_devtools_pytest-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bfba1813c4c341f40208a59e2f7a37a7287f2a5c1a37fdf1495e5fd584d49e36
BLAKE2b-256 checksum
How to use checksums
00c25dee820bfb91c92ca24cc3f81a930520caadb3c60b38f4d1738a1de1d5e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / ton_devtools_pytest-0.1.0-py3-none-any.whl

Download URL ton_devtools_pytest-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df1a0047e9247be458935ca1bd89977f2257739788f3ffd1974aabc71c2700a9
BLAKE2b-256 checksum
How to use checksums
d175b4220b5ddd16f2ab1e5cfca31e7ad19bdab86c856b636842b5a4c6b6863e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page