Permalink
Browse files

New tests + fix to one of them, fixes #871

  • Loading branch information...
1 parent a3e0a7d commit e1757f69fe81070d89a1591b0b918981b3848931 @bitprophet bitprophet committed Mar 21, 2013
Showing with 19 additions and 1 deletion.
  1. +1 −1 fabric/sftp.py
  2. +18 −0 integration/test_operations.py
View
@@ -230,7 +230,7 @@ def put(self, local_path, remote_path, use_sudo, mirror_local_mode, mode,
# Handle modes if necessary
if (local_is_path and mirror_local_mode) or (mode is not None):
lmode = os.stat(local_path).st_mode if mirror_local_mode else mode
- lmode = lmode & 07777
+ lmode = int(lmode, 8) & 07777
rmode = rattrs.st_mode & 07777
if lmode != rmode:
if use_sudo:
@@ -0,0 +1,18 @@
+from __future__ import with_statement
+
+from StringIO import StringIO
+
+from fabric.api import run, path, put
+
+from util import Integration
+
+
+class TestOperations(Integration):
+ def test_no_trailing_space_in_shell_path_in_run(self):
+ run("mkdir -p /tmp/whatever/bin")
+ put(StringIO("#!/bin/bash\necho hi"), "/tmp/whatever/bin/myapp", mode="0755")
+ with path('/tmp/whatever/bin'):
+ assert run('myapp').stdout == 'hi'
+
+ def test_string_put_mode_arg_doesnt_error(self):
+ put(StringIO("#!/bin/bash\necho hi"), "/tmp/whocares", mode="0755")

0 comments on commit e1757f6

Please sign in to comment.