Skip to main content

Helpers for unit-testing Juju charms

Project description

Latest Version Build Status Coverage Documentation Status

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.

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

charm-test-0.1.6.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

charm_test-0.1.6-py2.py3-none-any.whl (9.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file charm-test-0.1.6.tar.gz.

File metadata

  • Download URL: charm-test-0.1.6.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for charm-test-0.1.6.tar.gz
Algorithm Hash digest
SHA256 357cf30a64c782dc737cdaf7eec9a1e2bb8493b7cdc90fedec41051e65e5e0e9
MD5 8c619078166c4463809823a20223fc6e
BLAKE2b-256 1df8512a5883d82f130db1e1cfd89b40ad133ca53eb7f897d4aef1212c042d6e

See more details on using hashes here.

File details

Details for the file charm_test-0.1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for charm_test-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3139eaf4d0819eb300ce00a8543e0bcd5967e96fd343475ddff65006bf30b9c1
MD5 bf1f5a0b7f268dcb0f968d568b165bad
BLAKE2b-256 fcf84198402630334b1ba31ef31ba13bc39bdf0b382707fbf4cc58d25b3b3edb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page