class ApplicationTestCase(unittest.TestCase): def setUp(self): from tomate.app import Application self.app = Application(Mock(), view=Mock(), config=Mock(), plugin=Mock()) def test_run_when_not_running(self): self.app.run() self.app.view.run.assert_called_once_with() def test_run_when_already_running(self): self.app.state = State.running self.app.run() self.app.view.show.assert_called_once_with() def test_is_running(self): self.assertEqual(False, self.app.is_running()) self.app.state = State.running self.assertEqual(True, self.app.is_running())