예제 #1
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)
예제 #2
0
 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)
예제 #3
0
파일: container.py 프로젝트: fidian/pyshelf
    def runner(self):
        """
            Returns:
                pyshelf.bulk_update.runner.Runner
        """
        if not self._runner:
            self._runner = Runner(self)

        return self._runner
예제 #4
0
 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)
예제 #5
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)