Beispiel #1
0
 def test_scp_bad_dst_permission(self):
     system.echo("Hello, world!", "/tmp/labm8.tmp")
     self._test(["Hello, world!"], fs.read("/tmp/labm8.tmp"))
     # Error is raised if no write permission for destination.
     with self.assertRaises(system.ScpError):
         system.scp("localhost", "/tmp/labm8.tmp", "/dev",
                    path="tests/bin")
Beispiel #2
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="labm8/data/test/bin")
Beispiel #3
0
 def test_scp_bad_dst(self):
     system.echo("Hello, world!", "/tmp/labm8.tmp")
     self._test(["Hello, world!"], fs.read("/tmp/labm8.tmp"))
     # Error is raised if destination file cannot be written.
     with self.assertRaises(system.ScpError):
         system.scp("localhost", "/tmp/labm8.tmp", "/not/a/valid/path",
                    path="tests/bin")
Beispiel #4
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="labm8/data/test/bin")
Beispiel #5
0
def cp_rmt(host, path="~/.omnitune/skelcl.db", name=None):
    """
    Copy database from remote filesystem.
    """
    name = name or host
    dst = dst_path(name)

    io.info("Copying {host}:{path}".format(host=host, path=path), "->", name)
    system.scp(host, path, dst)
Beispiel #6
0
 def test_scp_user(self):
     system.echo("Hello, world!", "/tmp/labm8.tmp")
     self._test(["Hello, world!"], fs.read("/tmp/labm8.tmp"))
     # Cleanup any existing file.
     fs.rm("/tmp/labm8.tmp.copy")
     self._test(False, fs.exists("/tmp/labm8.tmp.copy"))
     # Perform scp.
     system.scp("localhost", "/tmp/labm8.tmp", "/tmp/labm8.tmp.copy",
                path="tests/bin", user="******")
     self._test(fs.read("/tmp/labm8.tmp"), fs.read("/tmp/labm8.tmp.copy"))
Beispiel #7
0
def test_scp_user():
  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="labm8/data/test/bin", user="******")
  assert fs.read("/tmp/labm8.tmp") == fs.read("/tmp/labm8.tmp.copy")
Beispiel #8
0
 def test_scp_bad_host(self):
     # Error is raised if host cannot be found.
     with self.assertRaises(system.ScpError):
         system.scp("not-a-real-host", "/not/a/real/path",
                    "/tmp/labm8.tmp.copy",
                    path="tests/bin")
Beispiel #9
0
 def test_scp_bad_src(self):
     # Error is raised if source file cannot be found.
     with self.assertRaises(system.ScpError):
         system.scp("localhost", "/not/a/real/path", "/tmp/labm8.tmp.copy",
                    path="tests/bin")
Beispiel #10
0
 def test_scp_no_scp(self):
     # Error is raised if scp binary cannot be found.
     with self.assertRaises(system.CommandNotFoundError):
         system.scp("localhost", "/not/a/real/path", "/tmp/labm8.tmp.copy",
                    path="tests/data")
Beispiel #11
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="labm8/data/test/bin")
Beispiel #12
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="labm8/data/test/bin")
Beispiel #13
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="labm8/data/test")