def setUp(self): """ Setup the IHandler class so that it responds to 'TestAction' string by executing FakeCommand """ self.handler = Handler() self.handler.handle_list = {"TestAction": FakeCommand() }
class TestIHandler(unittest.TestCase): """ Test the IHandler class """ def setUp(self): """ Setup the IHandler class so that it responds to 'TestAction' string by executing FakeCommand """ self.handler = Handler() self.handler.handle_list = {"TestAction": FakeCommand() } def test_that_when_you_call_handle_command_into_handle_list_then_perform_action_is_called(self): assert self.handler.handle_command("TestAction", "Data") def test_that_getting_a_thing_that_doesnt_exist_we_dont_exception(self): assert Statics.ERROR == self.handler.handle_command("NotExisting", "Data")