#2769: add change password action
This commit is contained in:
@@ -1077,16 +1077,16 @@ class NodeAccountsChangePasswordAction(AbstractAction):
|
|||||||
def __init__(self, manager: "ActionManager", **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", **kwargs) -> None:
|
||||||
super().__init__(manager=manager)
|
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."""
|
"""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):
|
class NodeSessionsRemoteLoginAction(AbstractAction):
|
||||||
"""Action which performs a remote session login."""
|
"""Action which performs a remote session login."""
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", **kwargs) -> None:
|
||||||
pass
|
super().__init__(manager=manager)
|
||||||
|
|
||||||
def form_request(self, node_id: str) -> RequestFormat:
|
def form_request(self, node_id: str) -> RequestFormat:
|
||||||
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
"""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."""
|
"""Action which performs a remote session logout."""
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", **kwargs) -> None:
|
||||||
pass
|
super().__init__(manager=manager)
|
||||||
|
|
||||||
def form_request(self, node_id: str) -> RequestFormat:
|
def form_request(self, node_id: str) -> RequestFormat:
|
||||||
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
||||||
|
|||||||
@@ -1071,7 +1071,10 @@ class Node(SimComponent):
|
|||||||
rm.add_request(
|
rm.add_request(
|
||||||
"logoff", RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on)
|
"logoff", RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on)
|
||||||
) # TODO implement logoff request
|
) # 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(
|
rm.add_request(
|
||||||
"remote_logon",
|
"remote_logon",
|
||||||
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),
|
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user