Fix a unit test regression from the diff comment fragments cache change.
Review Request #12316 — Created May 31, 2022 and submitted — Latest diff uploaded
The unit test introduced in 5bbcc128c for altering comment diff fragment
caching behavior on errors ended up being unstable. The Django function
we used to generate the cache header,patch_cache_control
, generates a
dictionary of items and then turns it into a single string. This means
that the order of items is not in a stable sort order, causing our
checks to sometimes fail.To fix this, we now split the
Cache-Control
header value, convert to a
set
, and compare the items within. This avoids any sorting issues
going forward.
Unit tests pass.