Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Helpers for unit-testing Juju charms

Project Description

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.

Release History

This version
History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.6

History Node

0.1.5

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
charm-test-0.2.2.tar.gz
(26.4 kB) Copy SHA256 Hash SHA256
Source None Mar 29, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting