From 4008f9ad9e9b0e7d88ff2c568757e6ae8f101f59 Mon Sep 17 00:00:00 2001 From: Lucas Gameiro Borges Date: Tue, 30 Apr 2024 18:12:58 +0000 Subject: [PATCH] revert new test changes --- tests/unit/test_charm.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) 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):