From cf6be5f58e72ba25ee6b904d90fce69a011fccf7 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 9 Oct 2015 16:02:34 +0200 Subject: [PATCH] add missing tests for async_executor --- tests/test_async_executor.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/test_async_executor.py diff --git a/tests/test_async_executor.py b/tests/test_async_executor.py new file mode 100644 index 00000000..17d7f94a --- /dev/null +++ b/tests/test_async_executor.py @@ -0,0 +1,18 @@ +import unittest + +from mock import Mock, patch +from patroni.async_executor import AsyncExecutor +from threading import Thread + + +class TestAsyncExecutor(unittest.TestCase): + + def setUp(self): + self.a = AsyncExecutor() + + @patch.object(Thread, 'start', Mock()) + def test_run_async(self): + self.a.run_async(Mock(return_value=True)) + + def test_run(self): + self.a.run(Mock(side_effect=Exception()))