From 7be495f9dd6e146f7426a0153cd856dd939a385e Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Wed, 18 Sep 2024 15:00:19 +1200 Subject: [PATCH] Restore test removed by mistake. --- tests/test_e2e/test_relations.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_e2e/test_relations.py b/tests/test_e2e/test_relations.py index cc77734d..ca39cc98 100644 --- a/tests/test_e2e/test_relations.py +++ b/tests/test_e2e/test_relations.py @@ -412,6 +412,19 @@ def test_relation_ids(): assert rel.id == initial_id + i +def test_broken_relation_not_in_model_relations(mycharm): + rel = Relation("foo") + + ctx = Context( + mycharm, meta={"name": "local", "requires": {"foo": {"interface": "foo"}}} + ) + with ctx(ctx.on.relation_broken(rel), state=State(relations={rel})) as mgr: + charm = mgr.charm + + assert charm.model.get_relation("foo") is None + assert charm.model.relations["foo"] == [] + + def test_get_relation_when_missing(): class MyCharm(CharmBase): def __init__(self, framework):