Skip to content

Commit

Permalink
incremented libpatch and added unit test for get_secret_id
Browse files Browse the repository at this point in the history
  • Loading branch information
skourta committed Sep 30, 2024
1 parent 484f930 commit 52d9410
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 1
LIBPATCH = 2


class OpenSearchPeerClusterRelation(Object):
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/lib/test_opensearch_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,15 @@ def test_bad_label(self):
@parameterized.expand([Scope.APP, Scope.UNIT])
def test_put_and_get_complex_obj(self, scope):
return

def test_get_secret_id(self):
# add a secret to the store
content = {"secret": "value"}
self.store.put(Scope.APP, "super-secret-key", content)
# get the secret id
secret_id = self.store.get_secret_id(Scope.APP, "super-secret-key")
self.assertIsNotNone(secret_id)
# check the secret content
secret = self.charm.model.get_secret(id=secret_id)
secret_content = secret.get_content()
self.assertDictEqual(secret_content, {"super-secret-key": str(content)})

0 comments on commit 52d9410

Please sign in to comment.