          request = HttpRequest()
          request.COOKIES['a'] = response.cookies['a'].value
          value = request.get_signed_cookie('a', salt='one')
          self.assertEqual(value, 'hello')
          self.assertRaises(signing.BadSignature,
              request.get_signed_cookie, 'a', salt='two')
  
      def test_detects_tampering(self):
          response = HttpResponse()
          response.set_signed_cookie('c', 'hello')
          request = HttpRequest()
 
</s> remove         self.assertRaises(signing.BadSignature,
            request.get_signed_cookie, 'c')
 </s> add         with self.assertRaises(signing.BadSignature):
            request.get_signed_cookie('c') </s> remove             self.assertRaises(signing.SignatureExpired,
                request.get_signed_cookie, 'c', max_age=10)
 </s> add             with self.assertRaises(signing.SignatureExpired):
                request.get_signed_cookie('c', max_age=10) </s> remove         self.assertRaises(ImproperlyConfigured, get_user, request)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            get_user(request) </s> remove         self.assertRaises(ValidationError, site.full_clean)
 </s> add         with self.assertRaises(ValidationError):
            site.full_clean() </s> remove         self.assertRaises(ValidationError, site.full_clean)
 </s> add         with self.assertRaises(ValidationError):
            site.full_clean()
        with self.assertRaises(signing.BadSignature):
            request.get_signed_cookie('a', salt='two')
          request = HttpRequest()
          request.COOKIES['a'] = response.cookies['a'].value
          value = request.get_signed_cookie('a', salt='one')
          self.assertEqual(value, 'hello')
        with self.assertRaises(signing.BadSignature):
            request.get_signed_cookie('a', salt='two')
        with self.assertRaises(signing.BadSignature):
            request.get_signed_cookie('a', salt='two')
  
      def test_detects_tampering(self):
          response = HttpResponse()
          response.set_signed_cookie('c', 'hello')
          request = HttpRequest()
keep keep keep keep replace replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/signed_cookies_tests/tests.py