console.py 100% test coverage

This commit is contained in:
Aldo Cortesi 2011-03-12 15:08:06 +13:00
parent fbbc43a5b2
commit 96b10ca486
2 changed files with 16 additions and 4 deletions

View File

@ -699,7 +699,6 @@ class ConsoleState(flow.State):
flow.State.__init__(self) flow.State.__init__(self)
self.focus = None self.focus = None
self.beep = None self.beep = None
self.store = None
self.view_body_mode = VIEW_BODY_RAW self.view_body_mode = VIEW_BODY_RAW
self.view_flow_mode = VIEW_FLOW_REQUEST self.view_flow_mode = VIEW_FLOW_REQUEST
@ -716,8 +715,6 @@ class ConsoleState(flow.State):
return f return f
def add_response(self, resp): def add_response(self, resp):
if self.store is not None:
self.store.save_response(resp)
f = flow.State.add_response(self, resp) f = flow.State.add_response(self, resp)
if self.focus is None: if self.focus is None:
self.set_focus(0) self.set_focus(0)

View File

@ -105,6 +105,15 @@ class uformat_flow(libpry.AutoTree):
assert ('method', '[replay] ') in console.format_flow(f, True) assert ('method', '[replay] ') in console.format_flow(f, True)
assert ('method', '[replay] ') in console.format_flow(f, True, True) assert ('method', '[replay] ') in console.format_flow(f, True, True)
f.response.code = 404
assert ('error', '404') in console.format_flow(f, True, True)
f.response.headers["content-type"] = ["text/html"]
assert ('text', ' text/html') in console.format_flow(f, True, True)
f.response =None
f.error = proxy.Error(f.request, "error")
assert ('error', 'error') in console.format_flow(f, True, True)
class uPathCompleter(libpry.AutoTree): class uPathCompleter(libpry.AutoTree):
@ -147,11 +156,17 @@ class uPathCompleter(libpry.AutoTree):
assert c.final == s assert c.final == s
class uOptions(libpry.AutoTree):
def test_all(self):
assert console.Options(beep=True)
tests = [ tests = [
uformat_keyvals(), uformat_keyvals(),
uformat_flow(), uformat_flow(),
uState(), uState(),
uPathCompleter() uPathCompleter(),
uOptions()
] ]