(self, cull_cache_name, initial_count, final_count)
| 687 | self.assertEqual(cache.get("key1"), "spam") |
| 688 | |
| 689 | def _perform_cull_test(self, cull_cache_name, initial_count, final_count): |
| 690 | try: |
| 691 | cull_cache = caches[cull_cache_name] |
| 692 | except InvalidCacheBackendError: |
| 693 | self.skipTest("Culling isn't implemented.") |
| 694 | |
| 695 | # Create initial cache key entries. This will overflow the cache, |
| 696 | # causing a cull. |
| 697 | for i in range(1, initial_count): |
| 698 | cull_cache.set("cull%d" % i, "value", 1000) |
| 699 | count = 0 |
| 700 | # Count how many keys are left in the cache. |
| 701 | for i in range(1, initial_count): |
| 702 | if cull_cache.has_key("cull%d" % i): |
| 703 | count += 1 |
| 704 | self.assertEqual(count, final_count) |
| 705 | |
| 706 | def test_cull(self): |
| 707 | self._perform_cull_test("cull", 50, 29) |
no test coverage detected