コード例 #1
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"))
    assert gunzip_cmd.done() is True
コード例 #2
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()
    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"))
    with pytest.raises(CommandFailure):
        gunzip_cmd()
コード例 #3
0
def test_gunzip_raise_error_on_cannot_overwrite(buffer_connection, command_output_and_expected_result_on_cannot_overwrite):
    gunzip_cmd = Gunzip(connection=buffer_connection.moler_connection, archive_name=["new5.gz"])
    command_output, expected_result = command_output_and_expected_result_on_cannot_overwrite
    buffer_connection.remote_inject_response([command_output])
    assert 'gunzip new5.gz' == gunzip_cmd.command_string
    with pytest.raises(CommandFailure):
        gunzip_cmd()
コード例 #4
0
def test_gunzip_raise_error_on_wrong_option(buffer_connection, command_output_and_expected_result_on_wrong_option):
    gunzip_cmd = Gunzip(connection=buffer_connection.moler_connection, archive_name=["old.gz"], options='-b')
    command_output, expected_result = command_output_and_expected_result_on_wrong_option
    buffer_connection.remote_inject_response([command_output])
    assert 'gunzip -b old.gz' == gunzip_cmd.command_string
    with pytest.raises(CommandFailure):
        gunzip_cmd()
コード例 #5
0
def test_gunzip_returns_proper_command_string(buffer_connection):
     gunzip_cmd = Gunzip(buffer_connection, archive_name=["old.gz"])
     assert "gunzip old.gz" == gunzip_cmd.command_string