Skip to content

Commit

Permalink
remove implementation for get-password and set-password user actions
Browse files Browse the repository at this point in the history
  • Loading branch information
reneradoi committed Dec 6, 2024
1 parent 2c5ebe6 commit ec03f83
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 210 deletions.
21 changes: 0 additions & 21 deletions actions.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from ops import StatusBase

from core.cluster import ClusterState
from events.actions import ActionEvents
from events.etcd import EtcdEvents
from literals import SUBSTRATE, DebugLevel, Status
from managers.cluster import ClusterManager
Expand All @@ -36,7 +35,6 @@ def __init__(self, *args):

# --- EVENT HANDLERS ---
self.etcd_events = EtcdEvents(self)
self.action_events = ActionEvents(self)

def set_status(self, key: Status) -> None:
"""Set charm status."""
Expand Down
75 changes: 0 additions & 75 deletions src/events/actions.py

This file was deleted.

13 changes: 0 additions & 13 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,3 @@ async def get_juju_leader_unit_name(ops_test: OpsTest, app_name: str = APP_NAME)
for unit in ops_test.model.applications[app_name].units:
if await unit.is_leader_from_status():
return unit.name


async def get_user_password(ops_test: OpsTest, user: str, unit: str) -> str:
"""Use the action to retrieve the password for a user.
Return:
String with the password stored on the peer relation databag.
"""
action = await ops_test.model.units.get(unit).run_action(
action_name="get-password", params={"username": user}
)
credentials = await action.wait()
return credentials.results["password"]
21 changes: 0 additions & 21 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
get_cluster_members,
get_juju_leader_unit_name,
get_key,
get_user_password,
put_key,
)

Expand Down Expand Up @@ -83,27 +82,7 @@ async def test_authentication(ops_test: OpsTest) -> None:
leader_unit = await get_juju_leader_unit_name(ops_test, APP_NAME)
test_key = "test_key"
test_value = "42"
new_password = "my_new_pwd"

# check that reading/writing data without credentials fails
assert get_key(model, leader_unit, endpoints, key=test_key) != test_value
assert put_key(model, leader_unit, endpoints, key=test_key, value=test_value) != "OK"

# run set-password action
action = await ops_test.model.units.get(leader_unit).run_action(
action_name="set-password", password=new_password
)
result = await action.wait()
assert result.results.get(f"{INTERNAL_USER}-password") == new_password

# run get-password action
updated_password = await get_user_password(ops_test, user=INTERNAL_USER, unit=leader_unit)
assert updated_password == new_password

# use updated password to read data
assert (
get_key(
model, leader_unit, endpoints, user=INTERNAL_USER, password=new_password, key=test_key
)
== test_value
)
78 changes: 0 additions & 78 deletions tests/unit/test_actions.py

This file was deleted.

0 comments on commit ec03f83

Please sign in to comment.