harness-extensions

Harness Extensions

Channel Revision Published Runs on
latest/beta 3 05 Jul 2022
Ubuntu 20.04
juju deploy harness-extensions --channel beta
Show information

Platform:

Ubuntu
20.04

charms.harness_extensions.v0.capture_events

This is a library providing a utility for unittesting events fired on a Harness-ed Charm.

Example usage:

from charms.harness_extensions.v0.capture_events import capture with capture(RelationEvent) as captured: harness.add_relation('foo', 'remote') assert captured.event.unit.name == 'remote'


def capture_events(charm: CharmBase)

Description

Capture all events of type *types (using instance checks). None

Methods

class Captured

Description

Object to type and expose return value of capture(). None

Methods

Captured. event( self )

Description

Return the captured event. None

Captured. event( self , val: _T )

def capture(
    charm: CharmBase,
    typ_
)

Capture exactly 1 event of type typ_.

Description

Will raise if more/less events have been fired, or if the returned event does not pass an instance check.