From b8691fb2523f2ecc8a8418f687082efdca4c8a51 Mon Sep 17 00:00:00 2001 From: Riken Shah Date: Wed, 24 Mar 2021 16:34:41 +0530 Subject: [PATCH] models: Add `clear_client_cache` function to clear `get_client_cache`. This is a prep commit, this function will be used when we want to reset the test environment of the puppeteer test. --- zerver/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zerver/models.py b/zerver/models.py index faa808e603..16ac433d9c 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1821,6 +1821,11 @@ class Client(models.Model): get_client_cache: Dict[str, Client] = {} +def clear_client_cache() -> None: # nocoverage + global get_client_cache + get_client_cache = {} + + def get_client(name: str) -> Client: # Accessing KEY_PREFIX through the module is necessary # because we need the updated value of the variable.