Exemple #1
0
def test_scp_bad_host():
    # Error is raised if host cannot be found.
    with pytest.raises(system.ScpError):
        system.scp("not-a-real-host",
                   "/not/a/real/path",
                   "/tmp/labm8.tmp.copy",
                   path="lib/labm8/data/test/bin")
Exemple #2
0
def test_scp_bad_src():
    # Error is raised if source file cannot be found.
    with pytest.raises(system.ScpError):
        system.scp("localhost",
                   "/not/a/real/path",
                   "/tmp/labm8.tmp.copy",
                   path="lib/labm8/data/test/bin")
Exemple #3
0
def test_scp_no_scp():
    # Error is raised if scp binary cannot be found.
    with pytest.raises(system.CommandNotFoundError):
        system.scp("localhost",
                   "/not/a/real/path",
                   "/tmp/labm8.tmp.copy",
                   path="lib/labm8/data/test")
Exemple #4
0
def test_scp_bad_dst_permission():
    system.echo("Hello, world!", "/tmp/labm8.tmp")
    assert ["Hello, world!"] == fs.read("/tmp/labm8.tmp")
    # Error is raised if no write permission for destination.
    with pytest.raises(system.ScpError):
        system.scp("localhost",
                   "/tmp/labm8.tmp",
                   "/dev",
                   path="lib/labm8/data/test/bin")
Exemple #5
0
def test_scp_bad_dst():
    system.echo("Hello, world!", "/tmp/labm8.tmp")
    assert ["Hello, world!"] == fs.read("/tmp/labm8.tmp")
    # Error is raised if destination file cannot be written.
    with pytest.raises(system.ScpError):
        system.scp("localhost",
                   "/tmp/labm8.tmp",
                   "/not/a/valid/path",
                   path="lib/labm8/data/test/bin")
Exemple #6
0
def test_scp():
    system.echo("Hello, world!", "/tmp/labm8.tmp")
    assert ["Hello, world!"] == fs.read("/tmp/labm8.tmp")
    # Cleanup any existing file.
    fs.rm("/tmp/labm8.tmp.copy")
    assert not fs.exists("/tmp/labm8.tmp.copy")
    # Perform scp.
    system.scp("localhost",
               "/tmp/labm8.tmp",
               "/tmp/labm8.tmp.copy",
               path="lib/labm8/data/test/bin")
    assert fs.read("/tmp/labm8.tmp") == fs.read("/tmp/labm8.tmp.copy")