From 011c9ce431a50fdac1a74e58cadbb63975e98628 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sun, 7 Feb 2010 14:20:47 -0500 Subject: Adding test for invalid action. --- kronos/cli.py | 6 +----- kronos/tests/test_cli.py | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kronos/cli.py b/kronos/cli.py index 72f0676..9e3e3bf 100644 --- a/kronos/cli.py +++ b/kronos/cli.py @@ -46,9 +46,5 @@ class CommandLineUI(object): controller(self.activity) -def main(): - CommandLineUI(sys.argv[:]).run() - - if __name__ == "__main__": - main() + CommandLineUI(sys.argv[:]).run() diff --git a/kronos/tests/test_cli.py b/kronos/tests/test_cli.py index 54aef81..a826a7e 100644 --- a/kronos/tests/test_cli.py +++ b/kronos/tests/test_cli.py @@ -34,3 +34,9 @@ class TestParsingErrors(object): def test_should_exit_if_not_enough_args(self): ui = CommandLineUI([]) assert_raises(SystemExit, ui.run) + + def test_should_exit_if_invalid_controller(self): + args = ['kronos', 'ducks', 'my action@home', '#stuff', '#good'] + ui = CommandLineUI(args) + + assert_raises(SystemExit, ui.run) -- cgit v1.2.3