def test_blacklist():
  client = make_logged_in_client('test')
  finish_confs = [
    proxy.conf.WHITELIST.set_for_testing(r"localhost:\d*"),
    proxy.conf.BLACKLIST.set_for_testing(r"localhost:\d*/(foo|bar)/fred/"),
  ]
  try:
    # Request 1: Hit the blacklist
    resp = client.get('/proxy/localhost/1234//foo//fred/')
    assert_true("is blocked" in resp.content)

    # Request 2: This is not a match
    httpd, finish = run_test_server()
    try:
      resp = client.get('/proxy/localhost/%s//foo//fred_ok' % (httpd.server_port,))
      assert_true("Hello there" in resp.content)
    finally:
      finish()
  finally:
    for fin in finish_confs:
      fin()
dataset/ETHPy150Open cloudera/hue/apps/proxy/src/proxy/proxy_test.py/test_blacklist/original