Skip to content

Commit

Permalink
[charm lib] Update dependency ops to v2.9.0 (canonical#343)
Browse files Browse the repository at this point in the history
* [charm lib] Update dependency ops to v2.9.0

* Fix unit test failures

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dragomir Penev <[email protected]>
  • Loading branch information
renovate[bot] and dragomirp authored Jan 3, 2024
1 parent 4346016 commit adfebfa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit adfebfa

Please sign in to comment.