Skip to main content

Testing toolbox for blacksmith

Project description

Whitesmith

Test helper for blacksmith resources.

Continuous Integration Coverage

Motivation

While using blacksmith, resources are declared using pydantic, and, while testing, we never do http calls.

Whitesmith is a helper that create pytest fixtures for blacksmith resources and generate handlers for tests.

Usage

Generating fixtures

whitesmith generate -m my_package.resources --out-dir tests/

The commande above will generate a folder tests/whitesmith containing handlers for all the api call with a default implementation.

Note If you run the command again, the command does not overrite generated files. To generate newer version, use the --overwrite flag.

Those fixtures can be adapted to get the result you want, they must be present in a whitesmith_handlers directory inside the tests suite.

Using the fixtures

The whitesmith package provide three pytest fixtures that can be used in the testsuite.

The sync_blacksmith_client, async_blacksmith_client can be used to get a blacksmith client instance that use the installed fixtures from the generated directory.

Both actually consume the undelying fixtures whitesmith_router is a generated fixture that contains all the routes contained in the whitesmith_handlers directory.

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

whitesmith-5.2.3.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

whitesmith-5.2.3-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file whitesmith-5.2.3.tar.gz.

File metadata

  • Download URL: whitesmith-5.2.3.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.26.7 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for whitesmith-5.2.3.tar.gz
Algorithm Hash digest
SHA256 76531fa840af8edfd3af7779a8b5e8abf90993da4d89d90fbc013cd9493ca671
MD5 c2e18ae5c606b02255d5dd3f9933e4db
BLAKE2b-256 24e95677e140f398dd5396040a8794c5adceae66d857c60c3cdd58da7b116dc7

See more details on using hashes here.

File details

Details for the file whitesmith-5.2.3-py3-none-any.whl.

File metadata

  • Download URL: whitesmith-5.2.3-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.26.7 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for whitesmith-5.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d8070c89f5a173382d72e8ef47d7f22db020ca52fcbd5e3b3ff2ed6e8948877a
MD5 f0602d7709cb46af611f5a517657b5b6
BLAKE2b-256 74b38bd9cd7aaee05b4e4ba75971a02f42bca20bb287031f5cbd362b3de2f7b8

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