Example #1
0
    def test_task_from_dict(self):

        conf = {TASK_ID: self.existing_function}

        task, params = get_task_with_params(conf=conf)

        self.assertEqual((task, params), (get_task_with_params, {}))
Example #2
0
    def test_task_from_str(self):

        conf = self.existing_function

        task, params = get_task_with_params(conf=conf)

        self.assertEqual((task, params), (get_task_with_params, {}))
Example #3
0
    def test_cache(self):

        conf = self.existing_function

        task_not_cached_0, _ = get_task_with_params(
            conf=conf, cache=False)

        task_not_cached_1, _ = get_task_with_params(
            conf=conf, cache=False)

        self.assertTrue(task_not_cached_0 is task_not_cached_1)

        task_cached_0, _ = get_task_with_params(conf=conf)

        task_cached_1, _ = get_task_with_params(conf=conf)

        self.assertTrue(task_cached_0 is task_cached_1)
Example #4
0
    def test_task_from_dict_with_params(self):

        param = {'a': 1}

        conf = {
            TASK_ID: self.existing_function,
            TASK_PARAMS: param}

        task, params = get_task_with_params(conf=conf)

        self.assertEqual((task, params), (get_task_with_params, param))