Exemplo n.º 1
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()
Exemplo n.º 2
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()
Exemplo n.º 3
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
Exemplo n.º 4
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()
Exemplo n.º 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