コード例 #1
0
ファイル: test_async.py プロジェクト: brianneal-wf/furious
    def test_setting_result(self):
        """Ensure the result can be set if the execute flag is set."""
        from furious.async import Async

        job = Async(target=dir)
        job.executing = True
        job.result = 123
        self.assertEqual(123, job.result)
        self.assertTrue(job.executed)
コード例 #2
0
    def test_setting_result(self):
        """Ensure the result can be set if the execute flag is set."""
        from furious. async import Async

        job = Async(target=dir)
        job.executing = True
        job.result = 123
        self.assertEqual(123, job.result)
        self.assertTrue(job.executed)
コード例 #3
0
ファイル: test_async.py プロジェクト: brianneal-wf/furious
    def test_getting_result(self):
        """Ensure getting the result after executing works."""
        from furious.async import Async

        job = Async(target=dir)
        job._executing = True
        job.result = 123456

        self.assertEqual(123456, job.result)
        self.assertTrue(job.executed)
コード例 #4
0
    def test_getting_result(self):
        """Ensure getting the result after executing works."""
        from furious. async import Async

        job = Async(target=dir)
        job._executing = True
        job.result = 123456

        self.assertEqual(123456, job.result)
        self.assertTrue(job.executed)
コード例 #5
0
ファイル: test_async.py プロジェクト: brianneal-wf/furious
    def test_setting_result_calls_persist(self):
        """Ensure setting the result calls the persist_result method."""
        from furious.async import Async

        result = "here be the results."

        persistence_engine = mock.Mock()

        job = Async(target=dir, persist_result=True)

        # Manually set the persistence_engine so that the Async doesn't try to
        # reload the mock persistence_engine.
        job._persistence_engine = persistence_engine

        job.executing = True
        job.result = result

        persistence_engine.store_async_result.assert_called_once_with(job.id, result)
コード例 #6
0
    def test_setting_result_calls_persist(self):
        """Ensure setting the result calls the persist_result method."""
        from furious. async import Async

        result = "here be the results."

        persistence_engine = mock.Mock()

        job = Async(target=dir, persist_result=True)

        # Manually set the persistence_engine so that the Async doesn't try to
        # reload the mock persistence_engine.
        job._persistence_engine = persistence_engine

        job.executing = True
        job.result = result

        persistence_engine.store_async_result.assert_called_once_with(
            job.id, result)
コード例 #7
0
ファイル: test_async.py プロジェクト: brianneal-wf/furious
    def test_setting_result_does_not_call_persist(self):
        """Ensure setting the result doesn't call persist result if not in
        persist mode.
        """
        from furious.async import Async

        result = "here be the results."

        persistence_engine = mock.Mock()

        job = Async(target=dir)

        # Manually set the persistence_engine so that the Async doesn't try to
        # reload the mock persistence_engine.
        job._persistence_engine = persistence_engine

        job.executing = True
        job.result = result

        self.assertEqual(persistence_engine.store_async_result.call_count, 0)
コード例 #8
0
    def test_setting_result_does_not_call_persist(self):
        """Ensure setting the result doesn't call persist result if not in
        persist mode.
        """
        from furious. async import Async

        result = "here be the results."

        persistence_engine = mock.Mock()

        job = Async(target=dir)

        # Manually set the persistence_engine so that the Async doesn't try to
        # reload the mock persistence_engine.
        job._persistence_engine = persistence_engine

        job.executing = True
        job.result = result

        self.assertEqual(persistence_engine.store_async_result.call_count, 0)