@run_with_all_backends
    def testCacheInvalidation(self):
        original_payload = RestoreConfig(
            project=self.project,
            user=self.user,
            params=RestoreParams(
                version=V2,
                sync_log_id=self.sync_log._id,
            ),
        ).get_payload().as_string()
        self.sync_log = get_properly_wrapped_sync_log(self.sync_log._id)
        self.assertTrue(self.sync_log.has_cached_payload(V2))

        # posting a case associated with this sync token should invalidate the cache
        case_id = "cache_invalidation"
        self._createCaseStubs([case_id])
        self.sync_log = get_properly_wrapped_sync_log(self.sync_log._id)
        self.assertFalse(self.sync_log.has_cached_payload(V2))

        # resyncing should recreate the cache
        next_payload = RestoreConfig(
            project=self.project,
            user=self.user,
            params=RestoreParams(
                version=V2,
                sync_log_id=self.sync_log._id,
            ),
        ).get_payload().as_string()
        self.sync_log = get_properly_wrapped_sync_log(self.sync_log._id)
        self.assertTrue(self.sync_log.has_cached_payload(V2))
        self.assertNotEqual(original_payload, next_payload)
        self.assertFalse(case_id in original_payload)
        # since it was our own update, it shouldn't be in the new payload either
        self.assertFalse(case_id in next_payload)
        # we can be explicit about why this is the case
        self.assertTrue(self.sync_log.phone_is_holding_case(case_id))
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/phone/tests/test_sync_mode.py/SyncTokenCachingTest.testCacheInvalidation/original