@@ -600,19 +600,24 @@ def test_filter_by_wealth_characteristic(self):
600600 self .assertEqual (len (response .json ()), 1 )
601601
602602 def test_conditional_request_headers (self ):
603-
604603 cache .clear () # Clear cache to ensure clean state
605- # Test that response includes ETag and Last-Modified headers
604+
605+ # Test that 200 response includes ETag, Last-Modified, Cache-Control, and Expires headers
606606 response = self .client .get (self .url )
607607 self .assertEqual (response .status_code , 200 )
608608 self .assertIn ("ETag" , response .headers )
609609 self .assertIn ("Last-Modified" , response .headers )
610+ self .assertIn ("Cache-Control" , response .headers )
611+ self .assertIn ("Expires" , response .headers )
610612 self .assertTrue (response .headers ["ETag" ].startswith ('W/"' )) # Weak ETag format
611613
612614 # Test If-None-Match returns 304 when not modified
613615 etag = response .headers ["ETag" ]
616+ cache .clear ()
614617 response = self .client .get (self .url , HTTP_IF_NONE_MATCH = etag )
615618 self .assertEqual (response .status_code , 304 )
619+ self .assertIn ("Cache-Control" , response .headers )
620+ self .assertIn ("Expires" , response .headers )
616621
617622 # Test If-None-Match returns 200 when data is modified
618623 cache .clear () # Clear cache before testing modified data
@@ -624,9 +629,12 @@ def test_conditional_request_headers(self):
624629 self .assertNotEqual (response .headers ["ETag" ], etag )
625630
626631 # Test If-Modified-Since with future date returns 304
632+ cache .clear ()
627633 future_date = http_date ((now () + timedelta (days = 1 )).timestamp ())
628634 response = self .client .get (self .url , HTTP_IF_MODIFIED_SINCE = future_date )
629635 self .assertEqual (response .status_code , 304 )
636+ self .assertIn ("Cache-Control" , response .headers )
637+ self .assertIn ("Expires" , response .headers )
630638
631639
632640class LivelihoodZoneBaselineFacetedSearchViewTestCase (APITestCase ):
0 commit comments