Files
test/unit_tests/parser/ptp/cat_clock_conf_parser_test.py
jpike fbc486950b Fixing parser for output when it's a compute
The compute doesn't have the prompt, we can't
just ignore the last line, we need to check if
it's a prompt first.

Change-Id: I532c9524b34476d1a5004585377cb0ebf81891df
2025-05-06 13:59:13 -04:00

36 lines
1.1 KiB
Python

from keywords.ptp.cat.objects.clock_conf_output import ClockConfOutput
# fmt: off
clock_conf_output = [
"ifname [enp138s0f0]\n",
"base_port [enp138s0f0]\n",
"sma1 input\n",
"ifname [enp81s0f0]\n",
"base_port [enp81s0f0]\n",
"sma1 output\n",
"sysadmin@controller-0:~$ \n"
]
def test_clock_conf_output():
"""
Test the cat clock conf parser and output.
"""
clock_config_output = ClockConfOutput(clock_conf_output)
clock_config_objects = clock_config_output.get_clock_conf_objects()
assert len(clock_config_objects), 2
clock_config_object = clock_config_objects[0]
assert clock_config_object.get_ifname() == "enp138s0f0"
assert clock_config_object.get_base_port() == "enp138s0f0"
assert clock_config_object.get_sma_name() == "sma1"
assert clock_config_object.get_sma_mode() == "input"
clock_config_object = clock_config_objects[1]
assert clock_config_object.get_ifname() == "enp81s0f0"
assert clock_config_object.get_base_port() == "enp81s0f0"
assert clock_config_object.get_sma_name() == "sma1"
assert clock_config_object.get_sma_mode() == "output"