def testInvalidRequestHeader(self):
    checks = {
      http.HttpUnauthorized: ["", "\t", "-", ".", "@", "<", ">", "Digest",
                              "basic %s" % "foobar".encode("base64").strip()],
      http.HttpBadRequest: ["Basic"],
      }

    ac = _SimpleAuthenticator("foo", "bar")
    for exc, headers in checks.items():
      for i in headers:
        headers = { http.HTTP_AUTHORIZATION: i, }
        req = http.server._HttpServerRequest("GET", "/", headers, None)
        ra = _FakeRequestAuth("area1", False, ac)
        self.assertRaises(exc, ra.PreHandleRequest, req)
dataset/ETHPy150Open ganeti/ganeti/test/py/ganeti.http_unittest.py/TestHttpServerRequestAuthentication.testInvalidRequestHeader/original