예제 #1
0
def test_handler_cmd_sub():
    subd.register_cam("test name 2")

    sub = subd.handler_cmd_sub("test name 2", blocking=False)

    assert isinstance(sub, VariableSub)
    assert sub.pub == subd.CV_CAM_HANDLERS_DICT["test name 2"].cmd_pub
예제 #2
0
def test_cam_frame_sub():
    subd.register_cam("test name 2")

    sub = subd.cam_frame_sub("test name 2", blocking=False)

    assert isinstance(sub, VariableSub)
    assert sub.pub == subd.CV_CAMS_DICT["test name 2"].frame_pub
예제 #3
0
def test_stop_cam():
    subd.register_cam("test name 2")
    cam_publish = subd.CV_CAMS_DICT[
        "test name 2"].cmd_pub.publish = mock.MagicMock()
    cam_handler_publish = subd.CV_CAM_HANDLERS_DICT[
        "test name 2"].cmd_pub.publish = mock.MagicMock()

    subd.stop_cam("test name 2")

    cam_publish.assert_called_once_with("quit", blocking=True)
    cam_handler_publish.assert_called_once_with("quit", blocking=True)
예제 #4
0
def test_register_cam():
    subd.register_cam("test name")
    assert isinstance(subd.CV_CAMS_DICT["test name"], subd.Cam)
    assert subd.CV_CAMS_DICT["test name"].name == "test name"
    assert isinstance(subd.CV_CAM_HANDLERS_DICT["test name"], subd.CamHandler)
    assert subd.CV_CAM_HANDLERS_DICT["test name"].name == "test name"