Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

core.put calls fabric.put within unpatched_state()

  • Loading branch information...
commit d7151285232d66df0e5459887a5ca34ff1672163 1 parent 6aad2eb
@michaelcontento authored
Showing with 20 additions and 4 deletions.
  1. +8 −2 revolver/core.py
  2. +12 −2 revolver/test/core_test.py
View
10 revolver/core.py
@@ -7,8 +7,10 @@
import cuisine
from fabric.api import run as _run
from fabric.api import sudo as _sudo
-from fabric.api import local, get, env, put
+from fabric.api import put as _put
+from fabric.api import local, get, env
+from revolver import contextmanager as _ctx
from revolver.decorator import inject_use_sudo
VERSION = '0.0.4'
@@ -16,7 +18,11 @@
env.sudo_forced = False
env.sudo_user = None
-put = inject_use_sudo(put)
+
+@inject_use_sudo
+def put(*args, **kwargs):
+ with _ctx.unpatched_state():
+ return _put(*args, **kwargs)
def run(*args, **kwargs):
View
14 revolver/test/core_test.py
@@ -16,8 +16,6 @@ def test_revolver_is_just_a_wrapper():
assert core.get == fabric.api.get
assert core.local == fabric.api.local
- assert_contain_function_wrapped(core.put, fabric.api.put)
-
def test_environment_default_values():
assert not core.env.sudo_forced
@@ -58,3 +56,15 @@ def test_inject_user_for_sudo_via_env(_sudo):
core.env.sudo_user = "bar"
core.sudo("foo")
core.env.sudo_user = None
+
+
+@patch("revolver.core._put")
+def test_put_does_not_pass_any_default_args(_put):
+ _put.expects_call().with_args()
+ core.put()
+
+
+@patch("revolver.core._put")
+def test_put_passes_any_given_args(_put):
+ _put.expects_call().with_args("foo", baz="bar")
+ core.put("foo", baz="bar")
Please sign in to comment.
Something went wrong with that request. Please try again.