From 7fef0ecdf5618d06e78ee8f833525d7784234df8 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 2 Apr 2012 09:30:38 +1200 Subject: Make "T" pretty view over-ride persistent when switching between flows. We do this by adding a flow settings mechanism to ConsoleState. This is pretty rough at the moment and should become more sophisticated as needed. --- test/test_console.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_console.py b/test/test_console.py index f8850590..4ed65a16 100644 --- a/test/test_console.py +++ b/test/test_console.py @@ -4,7 +4,7 @@ import tutils import libpry -class uState(libpry.AutoTree): +class uConsoleState(libpry.AutoTree): def test_flow(self): """ normal flow: @@ -76,6 +76,18 @@ class uState(libpry.AutoTree): assert len(c.view) == 3 assert c.focus == 0 + def test_settings(self): + c = console.ConsoleState() + f = self._add_request(c) + c.add_flow_setting(f, "foo", "bar") + assert c.get_flow_setting(f, "foo") == "bar" + assert c.get_flow_setting(f, "oink") == None + assert c.get_flow_setting(f, "oink", "foo") == "foo" + assert len(c.flowsettings) == 1 + c.delete_flow(f) + del f + assert len(c.flowsettings) == 0 + class uformat_keyvals(libpry.AutoTree): def test_simple(self): @@ -139,7 +151,7 @@ class uOptions(libpry.AutoTree): tests = [ uformat_keyvals(), - uState(), + uConsoleState(), uPathCompleter(), uOptions() ] -- cgit v1.2.3