Skip to content

Commit

Permalink
Fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nsklikas committed Mar 17, 2023
1 parent 9b32bde commit 0e838a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/hydra_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
logger = logging.getLogger(__name__)



class HydraCLI:
"""Helper object for running hydra CLI commands."""

Expand Down
23 changes: 7 additions & 16 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) == {}

0 comments on commit 0e838a4

Please # to comment.