From 1c37b67f85aa03d12965f62d90dad9fe3f0a7703 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Tue, 16 Apr 2024 12:21:56 +1200 Subject: [PATCH] Use a simpler name. --- scenario/mocking.py | 2 +- scenario/state.py | 2 +- tests/test_e2e/test_pebble.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scenario/mocking.py b/scenario/mocking.py index 6e1f9d1e..22b487b0 100644 --- a/scenario/mocking.py +++ b/scenario/mocking.py @@ -667,7 +667,7 @@ def __init__( self._notices: Dict[Tuple[str, str], pebble.Notice] = {} for container in state.containers: for notice in container.notices: - self._notices[str(notice.type), notice.key] = notice._to_ops_notice() + self._notices[str(notice.type), notice.key] = notice._to_ops() def get_plan(self) -> pebble.Plan: return self._container.plan diff --git a/scenario/state.py b/scenario/state.py index 62dc11bd..7108c212 100644 --- a/scenario/state.py +++ b/scenario/state.py @@ -668,7 +668,7 @@ class Notice(_DCBase): expire_after: Optional[datetime.timedelta] = None """How long since one of these last occurred until Pebble will drop the notice.""" - def _to_ops_notice(self) -> pebble.Notice: + def _to_ops(self) -> pebble.Notice: return pebble.Notice( id=self.id, user_id=self.user_id, diff --git a/tests/test_e2e/test_pebble.py b/tests/test_e2e/test_pebble.py index 73791d07..04dd75f1 100644 --- a/tests/test_e2e/test_pebble.py +++ b/tests/test_e2e/test_pebble.py @@ -383,4 +383,4 @@ def test_pebble_custom_notice(charm_cls): ctx = Context(charm_cls, meta={"name": "foo", "containers": {"foo": {}}}) with ctx.manager(cont.notice_event, state) as mgr: container = mgr.charm.unit.get_container("foo") - assert container.get_notices() == [n._to_ops_notice() for n in notices] + assert container.get_notices() == [n._to_ops() for n in notices]