コード例 #1
0
 def calls_Remote_run_with_command_and_kwargs_and_returns_its_result(
         self, Remote, client):
     remote = Remote.return_value
     sentinel = object()
     remote.run.return_value = sentinel
     c = Connection("host")
     r1 = c.run("command")
     r2 = c.run("command", warn=True, hide="stderr")
     # NOTE: somehow, .call_args & the methods built on it (like
     # .assert_called_with()) stopped working, apparently triggered by
     # our code...somehow...after commit (roughly) 80906c7.
     # And yet, .call_args_list and its brethren work fine. Wha?
     Remote.assert_any_call(c)
     remote.run.assert_has_calls(
         [call("command"),
          call("command", warn=True, hide="stderr")])
     for r in (r1, r2):
         assert r is sentinel
コード例 #2
0
 def calls_open_for_you(self, Remote, client):
     c = Connection("host")
     c.open = Mock()
     c.run("command")
     assert c.open.called