def test_quarantine(self): """ Test that quarantining a session adds the correct flags, and that lifting the quarantine similarly removes those flags. """ request = mock.MagicMock( session={} ) pipeline.quarantine_session(request, locations=('my_totally_real_module', 'other_real_module',)) self.assertEqual( request.session['third_party_auth_quarantined_modules'], ('my_totally_real_module', 'other_real_module',), ) pipeline.lift_quarantine(request) self.assertNotIn('third_party_auth_quarantined_modules', request.session)
def quarantine(request): """ Set a session variable to quarantine the user to ``enterprise.views``. """ quarantine_session(request, ('enterprise.views', ))