コード例 #1
0
ファイル: runner_test.py プロジェクト: kyle-long/pyshelf
class RunnerTest(UnitTestBase):
    """
        This test only exists for things that are not tested
        more functionally in the tests.bulk_update.utils_test.UtilsTest
    """
    def setUp(self):
        super(RunnerTest, self).setUp()
        self.fake_process = type("FakeProcess", (object,), {})()
        self.fake_process = Mock()
        self.fake_container = type("FakeContainer", (object,), {})()
        self.fake_container.config = {}
        self.fake_process_constructor = Mock(return_value=self.fake_process)
        MonkeyPatcher.patch(multiprocessing, "Process", self.fake_process_constructor)
        self.runner = Runner(self.fake_container)

    def test_run_process(self):
        fake_config = {
            "blah": "blah"
        }
        self.runner._run_process(fake_config)
        self.fake_process_constructor.assert_called_with(
            target=update_search_index,
            args=(fake_config,)
        )

        self.assertTrue(self.fake_process.start.called)
コード例 #2
0
class RunnerTest(UnitTestBase):
    """
        This test only exists for things that are not tested
        more functionally in the tests.bulk_update.utils_test.UtilsTest
    """
    def setUp(self):
        super(RunnerTest, self).setUp()
        self.fake_process = type("FakeProcess", (object, ), {})()
        self.fake_process = Mock()
        self.fake_container = type("FakeContainer", (object, ), {})()
        self.fake_container.config = {}
        self.fake_process_constructor = Mock(return_value=self.fake_process)
        MonkeyPatcher.patch(multiprocessing, "Process",
                            self.fake_process_constructor)
        self.runner = Runner(self.fake_container)

    def test_run_process(self):
        fake_config = {"blah": "blah"}
        self.runner._run_process(fake_config)
        self.fake_process_constructor.assert_called_with(
            target=update_search_index, args=(fake_config, ))

        self.assertTrue(self.fake_process.start.called)