Changes between Initial Version and Version 1 of Ticket #31944
- Timestamp:
- Aug 26, 2020, 2:55:24 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31944 – Description
initial v1 10 10 11 11 def enable(self): 12 # 1. Before setUp, TestContextDecorator runs enable(). 12 13 cm = override_settings(CSRF_COOKIE_NAME="cross_site_request_forgery_token") 13 14 self.stack.enter_context(cm) 14 15 15 16 def disable(self): 17 # 3. After tearDown, TestContextDecorator runs disable(), which restores settings captured in 1. 18 # This should be step 4. 16 19 self.stack.close() 17 20 … … 20 23 def setUp(self): 21 24 super().setUp() 25 # 2. Capture settings after they’ve been changed in 1. 22 26 settings_cm = self.settings(CACHES={}) 23 27 settings_cm.enable() 24 self.addCleanup(settings_cm.disable) 28 self.addCleanup(settings_cm.disable) # 4. Restore settings captured in 2. Should be executed at step 3. 25 29 26 30