예제 #1
0
    def test_remove_task_from_cache_value_not_in_cache(self):
        """Test that a task is removed."""
        task_list = [1, 2, 3, 4]
        _cache = WorkerCache()
        _cache.set_host_specific_task_list(task_list)
        self.assertEqual(_cache.host_specific_worker_cache, task_list)

        _cache.remove_task_from_cache(5)
        self.assertEqual(_cache.host_specific_worker_cache, task_list)
예제 #2
0
    def test_remove_task_from_cache(self):
        """Test that a task is removed."""
        task_key = "task_key"
        _cache = WorkerCache()
        _cache.add_task_to_cache(task_key)
        self.assertEqual(_cache.worker_cache, [task_key])

        _cache.remove_task_from_cache(task_key)
        self.assertEqual(_cache.worker_cache, [])
예제 #3
0
    def test_remove_task_from_cache_value_not_in_cache(self):
        """Test that a task is removed."""
        task_list = [1, 2, 3, 4]
        _cache = WorkerCache()
        for task in task_list:
            _cache.add_task_to_cache(task)
        self.assertEqual(_cache.worker_cache, task_list)

        _cache.remove_task_from_cache(5)
        self.assertEqual(_cache.worker_cache, task_list)
예제 #4
0
    def test_remove_task_from_cache(self):
        """Test that a task is removed."""
        task_list = [1, 2, 3, 4]
        expected = [1, 2, 3]
        _cache = WorkerCache()
        _cache.set_host_specific_task_list(task_list)
        self.assertEqual(_cache.host_specific_worker_cache, task_list)

        _cache.remove_task_from_cache(4)
        self.assertEqual(_cache.host_specific_worker_cache, expected)