class_docstr: Tests for `SecurityValidatorMiddleware`.
class_docstr_tok: ["Tests","for","`","SecurityValidatorMiddleware","`","."]
code: def make_request_and_maybe_assert_warn(
      self,
      headers,
      expected_warn_substr,
  ):
      @werkzeug.Request.application
      def _simple_app(req):
          return werkzeug.Response("OK", headers=headers)
  
      app = security_validator.SecurityValidatorMiddleware(_simple_app)
      server = werkzeug_test.Client(app, Response)
  
      with mock.patch.object(logger, "warning") as mock_warn:
          server.get("")
  
      if expected_warn_substr is None:
          mock_warn.assert_not_called()
      else:
          mock_warn.assert_called_with(
              _WARN_PREFIX + expected_warn_substr
          )
  
file_path: tensorboard/tensorboard/backend/security_validator_test.py
imports: from unittest import mock
  import werkzeug
  from werkzeug import test
  from werkzeug.datastructures import Headers
  from werkzeug.wrappers import Response
  from tensorboard import test
  from tensorboard.backend import security_validator
  from tensorboard.util import tb_logging
label_desc: Use image node_id 1 for calling the SecurityValidatorMiddlewareTest obj's underlying member method code with example usage: obj.make_request_and_maybe_assert_warn(headers, expected_warn_substr) and returns: werkzeug