def test_that_iproute2_link(*args): # dummy test device dv1 = TestDevice() out = IpLink.show( input_data=[{"test_dev": [{}]}], device_obj={"test_dev": dv1}, ) # check if the command was formed assert "command" in out[0]["test_dev"].keys() assert "result" in out[0]["test_dev"].keys() time.sleep(3)
def test_that_ip_link_show(capfd): dv1 = TestDevice(platform="dentos") dv2 = TestDevice(platform="dentos") loop = asyncio.get_event_loop() out = loop.run_until_complete( IpLink.show( input_data=[ { # device 1 "test_dev": [{}], } ], device_obj={"test_dev": dv1}, ) ) print(out) assert "command" in out[0]["test_dev"].keys() assert "result" in out[0]["test_dev"].keys() # check the rc assert out[0]["test_dev"]["rc"] == 0 loop = asyncio.get_event_loop() out = loop.run_until_complete( IpLink.show( input_data=[ { # device 1 "test_dev1": [ { # command 1 "device": "vddezuwe", "group": "sumbzdlo", "options": "gtamvyob", }, { # command 2 "device": "roytjska", "group": "fxncoyvf", "options": "vdvxqurp", }, ], } ], device_obj={"test_dev1": dv1, "test_dev2": dv2}, ) ) print(out) # check if the command was formed assert "command" in out[0]["test_dev1"].keys() # check if the result was formed assert "result" in out[0]["test_dev1"].keys() # check the rc assert out[0]["test_dev1"]["rc"] == 0 loop = asyncio.get_event_loop() out = loop.run_until_complete( IpLink.show( input_data=[ { # device 1 "test_dev1": [ { "device": "vddezuwe", "group": "sumbzdlo", "options": "gtamvyob", } ], # device 2 "test_dev2": [ { "device": "roytjska", "group": "fxncoyvf", "options": "vdvxqurp", } ], } ], device_obj={"test_dev1": dv1, "test_dev2": dv2}, ) ) print(out) # check if the command was formed assert "command" in out[0]["test_dev1"].keys() assert "command" in out[1]["test_dev2"].keys() # check if the result was formed assert "result" in out[0]["test_dev1"].keys() assert "result" in out[1]["test_dev2"].keys() # check the rc assert out[0]["test_dev1"]["rc"] == 0 assert out[1]["test_dev2"]["rc"] == 0