MCPcopy
hub / github.com/fabric/fabric / get

Class get

integration/transfer.py:15–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14class Transfer_:
15 class get:
16 def setup(self):
17 self.c = Connection("localhost")
18 self.remote = _support("file.txt")
19
20 def base_case(self, tmpdir):
21 # Copy file from support to tempdir
22 with tmpdir.as_cwd():
23 result = self.c.get(self.remote)
24
25 # Make sure it arrived
26 local = tmpdir.join("file.txt")
27 assert local.check()
28 assert local.read() == "yup\n"
29 # Sanity check result object
30 assert result.remote == self.remote
31 assert result.orig_remote == self.remote
32 assert result.local == str(local)
33 assert result.orig_local is None
34
35 def file_like_objects(self):
36 fd = BytesIO()
37 result = self.c.get(remote=self.remote, local=fd)
38 assert fd.getvalue() == b"yup\n"
39 assert result.remote == self.remote
40 assert result.local is fd
41
42 def mode_preservation(self, tmpdir):
43 # Use a dummy file which is given an unusual, highly unlikely to be
44 # default umask, set of permissions (oct 641, aka -rw-r----x)
45 local = tmpdir.join("funky-local.txt")
46 remote = tmpdir.join("funky-remote.txt")
47 remote.write("whatever")
48 remote.chmod(0o641)
49 self.c.get(remote=str(remote), local=str(local))
50 assert stat.S_IMODE(local.stat().mode) == 0o641
51
52 class put:
53 def setup(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected