Skip to main content

pytest plugin providing declarative fixtures for ICP integration testing

Project description

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

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

ton_devtools_pytest-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

ton_devtools_pytest-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file ton_devtools_pytest-0.1.0.tar.gz.

File metadata

  • Download URL: ton_devtools_pytest-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for ton_devtools_pytest-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfba1813c4c341f40208a59e2f7a37a7287f2a5c1a37fdf1495e5fd584d49e36
MD5 8e58296df4b0963fb70a99cfd895da96
BLAKE2b-256 00c25dee820bfb91c92ca24cc3f81a930520caadb3c60b38f4d1738a1de1d5e5

See more details on using hashes here.

File details

Details for the file ton_devtools_pytest-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ton_devtools_pytest-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df1a0047e9247be458935ca1bd89977f2257739788f3ffd1974aabc71c2700a9
MD5 34eaafbcbf14c76bef36bc5ddd569695
BLAKE2b-256 d175b4220b5ddd16f2ab1e5cfca31e7ad19bdab86c856b636842b5a4c6b6863e

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