Charm Test
This package sports a collection of helpers for unit-testing Juju charms.
In particular, it extends systemfixtures by faking out hook tools processes (config-get, juju-log, etc), so authors have a complete suite of fakes for the typical “boundaries” of a Juju charm.
>>> from testtools.matchers import DirExists
>>>
>>> from charmtest import CharmTest
>>>
>>> from charmhelpers.core import hookenv
>>>
>>>
>>> def example_charm_logic():
... return {
... "service-name": hookenv.service_name(),
... "local-unit": hookenv.local_unit(),
... "charm-dir": hookenv.charm_dir(),
... }
>>>
>>>
>>> class ExampleCharmTest(CharmTest):
...
... def test_charm_logic(self):
... result = example_charm_logic()
... self.assertEqual("test", result["service-name"])
... self.assertEqual("test/0", result["local-unit"])
... self.assertThat(result["charm-dir"], DirExists())
>>>
>>>
>>> ExampleCharmTest(methodName="test_charm_logic").run().wasSuccessful()
True
Support and Documentation
See the online documentation for a complete reference.
Developing and Contributing
See the GitHub project. Bugs can be filed in the issues tracker.
Metadata
Release files for charm-test 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| charm-test-0.2.2.tar.gz | 26.4 kB | Without provenance | Details for charm-test-0.2.2.tar.gz |
Release files / charm-test-0.2.2.tar.gz
| Download URL | charm-test-0.2.2.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb35ac13c78c58599e98143ddff1c81690a3e5c6cb6d93ee3051ac35aa884827
|
|
BLAKE2b-256 checksum How to use checksums |
31927cb9be9789c3446f0a69cb04e4612fab287cb6c422d710219488399a2c4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for charm-test 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.