def basic_invocation(self, Remote, client): # Technically duplicates Invoke-level tests, but ensures things # still work correctly at our level. cxn = Connection("host") cxn.sudo("foo") cmd = "sudo -S -p '{}' foo".format(cxn.config.sudo.prompt) # NOTE: this is another spot where Mock.call_args is inexplicably # None despite call_args_list being populated. WTF. (Also, # Remote.return_value is two different Mocks now, despite Remote's # own Mock having the same ID here and in code under test. WTF!!) expected = [call(cxn), call().run(cmd, watchers=ANY)] assert Remote.mock_calls == expected
def calls_open_for_you(self, Remote, client): c = Connection("host") c.open = Mock() c.sudo("command") assert c.open.called