puppeteer_tests: Use POST for flush_caches call.

This commit is contained in:
Tim Abbott 2021-03-25 12:47:54 -07:00
parent 99f8be6a12
commit f5b7e5d934
2 changed files with 5 additions and 1 deletions

View File

@ -90,7 +90,7 @@ def run_tests(files: Iterable[str], external_host: str) -> None:
# Resetting test environment.
reset_zulip_test_database()
# We are calling to /flush_caches to remove all the server-side caches.
response = requests.get("http://zulip.zulipdev.com:9981/flush_caches")
response = requests.post("http://zulip.zulipdev.com:9981/flush_caches")
assert response.status_code == 200
if ret != 0:

View File

@ -1,7 +1,9 @@
import os
from django.http import HttpRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from zerver.decorator import require_post
from zerver.lib.cache import get_cache_backend
from zerver.lib.response import json_success
from zerver.models import clear_client_cache, flush_per_request_caches
@ -9,6 +11,8 @@ from zerver.models import clear_client_cache, flush_per_request_caches
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../")
# This is used only by the Puppeteer Tests to clear all the cache after each run.
@csrf_exempt
@require_post
def remove_caches(request: HttpRequest) -> HttpResponse:
cache = get_cache_backend(None)
cache.clear()