コード例 #1
0
def test_GIVEN_broker_WHEN_creting_writer_commands_THEN_broker_is_present_in_write_command(
):
    broker = "test:9092"
    start_cmd, _ = create_writer_commands({},
                                          output_filename="",
                                          broker=broker)
    assert start_cmd["broker"] == broker
コード例 #2
0
def test_GIVEN_disable_hdf_swmr_WHEN_writing_start_command_THEN_disable_hdf_swmr_in_write_cmd(
):
    start_cmd, _ = create_writer_commands({},
                                          output_filename="file.nxs",
                                          broker="broker",
                                          use_hdf_swmr=False)
    assert "use_hdf_swmr" in start_cmd.keys()
    assert not start_cmd["use_hdf_swmr"]
コード例 #3
0
def test_GIVEN_output_file_WHEN_creating_writer_commands_THEN_output_file_is_present_in_write_command(
):
    filename = "test.nxs"
    start_cmd, _ = create_writer_commands({},
                                          output_filename=filename,
                                          broker="")

    assert start_cmd["file_attributes"]["file_name"] == filename
コード例 #4
0
def test_GIVEN_stop_time_WHEN_creating_writer_commands_THEN_stop_time_is_included_in_command(
):
    stop_time = 123_231_412
    _, stop_cmd = create_writer_commands({},
                                         "",
                                         stop_time=stop_time,
                                         broker="")
    assert stop_cmd["stop_time"] == stop_time
コード例 #5
0
def test_GIVEN_start_time_WHEN_creating_writercommands_THEN_start_time_is_included_in_command(
):
    start_time = 123_413_425
    start_cmd, _ = create_writer_commands({},
                                          "",
                                          start_time=start_time,
                                          broker="")
    assert start_cmd["start_time"] == start_time
コード例 #6
0
def test_GIVEN_none_as_service_id_WHEN_generating_writer_commands_THEN_service_id_is_not_in_commands(
):
    start_cmd, stop_cmd = create_writer_commands({},
                                                 output_filename="file.nxs",
                                                 broker="broker",
                                                 job_id="123",
                                                 service_id=None)
    assert "service_id" not in start_cmd.keys()
    assert "service_id" not in stop_cmd.keys()
コード例 #7
0
def test_GIVEN_blank_service_id_WHEN_generating_start_and_stop_commands_THEN_service_id_not_in_write_or_stop_command(
):
    start_cmd, stop_cmd = create_writer_commands({},
                                                 output_filename="file.nxs",
                                                 broker="broker",
                                                 job_id="123",
                                                 service_id="")
    assert "service_id" not in start_cmd.keys()
    assert "service_id" not in stop_cmd.keys()
コード例 #8
0
def test_GIVEN_job_id_WHEN_creating_writer_commands_THEN_job_id_is_present_in_commands(
):
    job_id = "something"
    start_cmd, stop_cmd = create_writer_commands({},
                                                 "",
                                                 job_id=job_id,
                                                 broker="")
    assert start_cmd["job_id"] == job_id
    assert stop_cmd["job_id"] == job_id
コード例 #9
0
def test_GIVEN_abort_uninitialised_stream_WHEN_writing_start_command_THEN_abort_uninitialised_stream_is_in_start_cmd(
):
    start_cmd, _ = create_writer_commands(
        {},
        output_filename="file.nxs",
        broker="broker",
        abort_on_uninitialised_stream=True,
    )
    assert "abort_on_uninitialised_stream" in start_cmd.keys()
    assert start_cmd["abort_on_uninitialised_stream"]
コード例 #10
0
def test_GIVEN_no_job_id_WHEN_creating_writer_commands_THEN_job_id_is_auto_generated(
):
    start_cmd, stop_cmd = create_writer_commands({}, "", broker="")
    assert start_cmd["job_id"]
    assert stop_cmd["job_id"]