File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
simple_history/tests/tests Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,19 @@ def test_middleware_saves_user(self):
185
185
self .assertEqual (historical_poll .history_user , self .user ,
186
186
"Middleware should make the request available to "
187
187
"retrieve history_user." )
188
+
189
+ def test_middleware_anonymous_user (self ):
190
+ overridden_settings = {
191
+ 'MIDDLEWARE_CLASSES' :
192
+ settings .MIDDLEWARE_CLASSES
193
+ + ['simple_history.middleware.HistoryRequestMiddleware' ],
194
+ }
195
+ with override_settings (** overridden_settings ):
196
+ poll = Poll .objects .create (question = "why?" , pub_date = today )
197
+ historical_poll = poll .history .all ()[0 ]
198
+ self .assertEqual (historical_poll .history_user , None ,
199
+ "Middleware request user should be able to "
200
+ "be anonymous." )
188
201
189
202
def test_other_admin (self ):
190
203
"""Test non-default admin instances.
You can’t perform that action at this time.
0 commit comments