From 0e838a447ce71e0d4202fd96928281d8a93e0025 Mon Sep 17 00:00:00 2001 From: Nikos Date: Fri, 17 Mar 2023 19:10:18 +0200 Subject: [PATCH] Fix rebase --- src/hydra_cli.py | 1 - tests/unit/test_charm.py | 23 +++++++---------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/hydra_cli.py b/src/hydra_cli.py index bdc83bb0..72f221b2 100644 --- a/src/hydra_cli.py +++ b/src/hydra_cli.py @@ -14,7 +14,6 @@ logger = logging.getLogger(__name__) - class HydraCLI: """Helper object for running hydra CLI commands.""" diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 11bfc505..2f55a793 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -591,30 +591,21 @@ def test_client_changed_event_when_error( ) -def test_client_deleted_when_client_deleted_event_is_emitted(harness, mocked_hydra_cli): +def test_client_deleted_when_client_deleted_event_is_emitted( + harness, + mocked_create_client: MagicMock, + mocked_delete_client: MagicMock, + mocked_hydra_is_running: MagicMock, +): client_id = "client_id" harness.set_can_connect(CONTAINER_NAME, True) harness.charm.on.hydra_pebble_ready.emit(CONTAINER_NAME) - mocked_hydra_cli.return_value = ( - json.dumps({"client_id": client_id, "client_secret": "client_secret"}), - None, - ) peer_relation_id, _ = setup_peer_relation(harness) relation_id, _ = setup_oauth_relation(harness) harness.charm.oauth.on.client_created.emit(relation_id=relation_id, **CLIENT_CONFIG) - mocked_hydra_cli.return_value = (json.dumps(dict(client_id=client_id)), None) harness.charm.oauth.on.client_deleted.emit(relation_id) - assert mocked_hydra_cli.call_args[0][0] == [ - "hydra", - "delete", - "client", - "--endpoint", - "http://localhost:4445", - "--format", - "json", - client_id, - ] + mocked_delete_client.assert_called_with(client_id) assert harness.get_relation_data(peer_relation_id, harness.charm.app) == {}