Skip to content

Instantly share code, notes, and snippets.

@elyezer
Created September 9, 2014 11:49
Show Gist options
  • Save elyezer/36f880da2189669217ed to your computer and use it in GitHub Desktop.
Save elyezer/36f880da2189669217ed to your computer and use it in GitHub Desktop.
vm = VirtualMachine()
def create_mock():
vm._created = True
vm.ip_addr = '192.168.0.1'
with patch.object(vm, 'create', side_effect=create_mock):
vm.create()
vm.run('ls')
ssh_command.assert_called_once_with('ls', hostname='192.168.0.1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment