diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 87ab7d4293..94dccda818 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -1719,7 +1719,7 @@ def test_scope_obj(harness): @patch_network_get(private_address="1.1.1.1") -def test_get_secret(harness): +def test_get_secret_from_databag(harness): with patch("charm.PostgresqlOperatorCharm._on_leader_elected"): rel_id = harness.model.get_relation(PEER).id # App level changes require leader privileges @@ -1814,31 +1814,6 @@ def test_set_secret_in_databag(harness, only_without_juju_secrets): harness.charm.set_secret("test", "password", "test") -@patch_network_get(private_address="1.1.1.1") -def test_set_secret_with_juju_secret(harness): - # this test is the juju3 version of the previous test, but it can run on both versions - # as it is backwards compatible behavior (usage of set_secret/get_secret) - with patch("charm.PostgresqlOperatorCharm._on_leader_elected"): - rel_id = harness.model.get_relation(PEER).id - harness.set_leader() - - # Test application scope. - assert "password" not in harness.get_relation_data(rel_id, harness.charm.app.name) - harness.charm.set_secret("app", "password", "test-password") - assert harness.charm.get_secret("app", "password") == "test-password" - harness.charm.set_secret("app", "password", None) - assert "password" not in harness.get_relation_data(rel_id, harness.charm.app.name) - - # Test unit scope. - assert "password" not in harness.get_relation_data(rel_id, harness.charm.unit.name) - harness.charm.set_secret("unit", "password", "test-password") - assert harness.charm.get_secret("unit", "password") == "test-password" - harness.charm.set_secret("unit", "password", None) - assert "password" not in harness.get_relation_data(rel_id, harness.charm.unit.name) - with pytest.raises(RuntimeError): - harness.charm.set_secret("test", "password", "test") - - @pytest.mark.parametrize("scope,is_leader", [("app", True), ("unit", True), ("unit", False)]) @patch_network_get(private_address="1.1.1.1") def test_set_reset_new_secret(harness, scope, is_leader):