diff --git a/poetry.lock b/poetry.lock index 8673867adb..5b25b8b3e0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1022,13 +1022,13 @@ signedtoken = ["cryptography (>=3.0.0)", "pyjwt (>=2.0.0,<3)"] [[package]] name = "ops" -version = "2.8.0" +version = "2.9.0" description = "The Python library behind great charms" optional = false python-versions = ">=3.8" files = [ - {file = "ops-2.8.0-py3-none-any.whl", hash = "sha256:31736fd98f327d3a4b8825e5d37c077ec838dd0b2579ffbb3852521b01f37b98"}, - {file = "ops-2.8.0.tar.gz", hash = "sha256:bf7788fc6a79ee6fc9cc21f98be80fa685a605257ea8e5406f08a2e0a2dcdcb5"}, + {file = "ops-2.9.0-py3-none-any.whl", hash = "sha256:1d443e4d45e0c2443b8334d37a177287f22a12ee0cb02a30cf7c3159316cb643"}, + {file = "ops-2.9.0.tar.gz", hash = "sha256:d3c541659eded56f42f9c18270408cc6313895968f1360b3f1de75c99cc99ada"}, ] [package.dependencies] diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 0cabc75dac..3d88f4c0be 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -234,6 +234,8 @@ def test_on_get_password(self): @pytest.mark.usefixtures("only_with_juju_secrets") def test_on_get_password_secrets(self): + self.harness.set_leader() + # Create a mock event and set passwords in peer relation data. mock_event = MagicMock(params={}) self.harness.charm.set_secret("app", "operator-password", "test-password") @@ -803,7 +805,8 @@ def test_set_secret_returning_secret_label(self, scope): @parameterized.expand([("app"), ("unit")]) @pytest.mark.usefixtures("only_with_juju_secrets") def test_set_reset_new_secret(self, scope): - """NOTE: currently ops.testing seems to allow for non-leader to set secrets too!""" + self.harness.set_leader() + # Getting current password self.harness.charm.set_secret(scope, "new-secret", "bla") assert self.harness.charm.get_secret(scope, "new-secret") == "bla" @@ -869,7 +872,8 @@ def test_delete_password(self): @pytest.mark.usefixtures("only_with_juju_secrets") @pytest.mark.usefixtures("use_caplog") def test_delete_existing_password_secrets(self): - """NOTE: currently ops.testing seems to allow for non-leader to remove secrets too!""" + self.harness.set_leader() + assert self.harness.charm.set_secret("app", "replication", "somepw") self.harness.charm.remove_secret("app", "replication") assert self.harness.charm.get_secret("app", "replication") is None