示例#1
0
def test_gunzip_raise_error_on_cannot_overwrite_multiple_files(
        buffer_connection, command_output_and_expected_result_on_cannot_overwrite_multiple_files):
    gunzip_cmd = Gunzip(connection=buffer_connection.moler_connection, archive_name=["new5.gz", "new.gz"])
    assert 'gunzip new5.gz new.gz' == gunzip_cmd.command_string
    gunzip_cmd.start()
    time.sleep(0.1)
    command_output, expected_result = command_output_and_expected_result_on_cannot_overwrite_multiple_files
    for output in command_output:
        buffer_connection.moler_connection.data_received(output.encode("utf-8"), datetime.datetime.now())
    with pytest.raises(CommandFailure):
        gunzip_cmd()
    gunzip_cmd.cancel()
示例#2
0
def test_gunzip_raise_error_on_can_multiple_files(
        buffer_connection, command_output_and_expected_result_on_overwrite_multiple_files):
    gunzip_cmd = Gunzip(connection=buffer_connection.moler_connection,
                        archive_name=["new5.gz", "new.gz"], overwrite=True)
    assert 'gunzip new5.gz new.gz' == gunzip_cmd.command_string
    gunzip_cmd.start()
    time.sleep(0.1)
    command_output, expected_result = command_output_and_expected_result_on_overwrite_multiple_files
    for output in command_output:
        buffer_connection.moler_connection.data_received(output.encode("utf-8"), datetime.datetime.now())
    gunzip_cmd.await_done(timeout=1)
    assert gunzip_cmd.done() is True
    gunzip_cmd.cancel()