#2769: add change password action

This commit is contained in:
Czar Echavez
2024-07-25 10:02:32 +01:00
parent 173f110fb2
commit df50ec8abc
3 changed files with 21 additions and 5 deletions

View File

@@ -1077,16 +1077,16 @@ class NodeAccountsChangePasswordAction(AbstractAction):
def __init__(self, manager: "ActionManager", **kwargs) -> None:
super().__init__(manager=manager)
def form_request(self) -> RequestFormat:
def form_request(self, node_id: str) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
pass
return ["network", "node", node_id, "change_password"]
class NodeSessionsRemoteLoginAction(AbstractAction):
"""Action which performs a remote session login."""
def __init__(self, manager: "ActionManager", **kwargs) -> None:
pass
super().__init__(manager=manager)
def form_request(self, node_id: str) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
@@ -1097,7 +1097,7 @@ class NodeSessionsRemoteLogoutAction(AbstractAction):
"""Action which performs a remote session logout."""
def __init__(self, manager: "ActionManager", **kwargs) -> None:
pass
super().__init__(manager=manager)
def form_request(self, node_id: str) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""

View File

@@ -1071,7 +1071,10 @@ class Node(SimComponent):
rm.add_request(
"logoff", RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on)
) # TODO implement logoff request
rm.add_request(
"change_password",
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),
) # TODO implement change_password request
rm.add_request(
"remote_logon",
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),

View File

@@ -0,0 +1,13 @@
# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
def test_remote_logon(game_and_agent):
"""Test that the remote session login action works."""
game, agent = game_and_agent
action = (
"NODE_ACCOUNTS_CHANGEPASSWORD",
{"node_id": 0},
)
agent.store_action(action)
game.step()
# TODO Assert that the user account password is changed