Skip to content

Instantly share code, notes, and snippets.

@mgood
Created October 28, 2011 21:06
Show Gist options
  • Save mgood/1323560 to your computer and use it in GitHub Desktop.
Save mgood/1323560 to your computer and use it in GitHub Desktop.
dalton capturing
import dalton
dalton.inject()
from httplib import HTTPConnection
recorder = dalton.Recorder(caller=HTTPConnection('www.google.com'))
def test():
h = HTTPConnection('www.google.com')
h.request('GET', '/')
resp = h.getresponse()
body = resp.read()
assert body.startswith('<!doctype html>')
with recorder.recording():
test()
recorder.save('google')
player = dalton.Player(caller=HTTPConnection('www.google.com'), playback_dir='google')
with player.playing():
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment