diff --git a/src/lvmnps/actor/actor.py b/src/lvmnps/actor/actor.py index 2bdb0db..25281ef 100644 --- a/src/lvmnps/actor/actor.py +++ b/src/lvmnps/actor/actor.py @@ -54,7 +54,13 @@ def get_nps_from_config(config: Configuration) -> NPSClient: return DLIClient(**init_parameters) - raise RuntimeError("Failed creating NPS client from configuration.") + elif nps_type == "netio": + from lvmnps.nps.implementations.netio import NetIOClient + + return NetIOClient(**init_parameters) + + else: # pragma: no cover - This should unreachable. + raise ValueError(f"Invalid NPS {nps_type}. Valid types are {VALID_NPS_TYPES}.") class NPSActor(AMQPActor): diff --git a/tests/test_actor.py b/tests/test_actor.py index 7438ef3..44f04cd 100644 --- a/tests/test_actor.py +++ b/tests/test_actor.py @@ -14,6 +14,7 @@ from pytest_mock import MockerFixture from lvmnps.actor.actor import NPSActor +from lvmnps.nps.implementations.netio import NetIOClient if TYPE_CHECKING: @@ -41,6 +42,13 @@ async def test_actor_config_missing(lvmnps_config: Configuration): NPSActor.from_config(lvmnps_config) +async def test_actor_netio_nps(lvmnps_config: Configuration): + lvmnps_config["nps"]["type"] = "netio" + + actor = NPSActor.from_config(lvmnps_config) + assert isinstance(actor.nps, NetIOClient) + + async def test_command_status(nps_actor: NPSActor, mocker: MockerFixture): cmd = await nps_actor.invoke_mock_command("status") await cmd