tests/test-wsgicgi.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 09 Apr 2024 14:36:01 +0200
changeset 51573 4a9d0898bf16
parent 50937 04bfcb416745
permissions -rw-r--r--
bundlespec: fix the "streamv2" and "streamv3-exp" variant In c4aab3661f25, we broken this feature by adding unicode instead of bytes to the dictionary. On the other hand, this feature was never tested, so augment the tests to tests this.

  $ hg init test
  $ cat >hgweb.cgi <<HGWEB
  > #!$PYTHON
  > from mercurial import demandimport; demandimport.enable()
  > from mercurial.hgweb import hgweb
  > from mercurial.hgweb import wsgicgi
  > application = hgweb(b"test", b"Empty test repository")
  > wsgicgi.launch(application)
  > HGWEB
  $ chmod 755 hgweb.cgi

Check that non-ASCII bytes roundtrip correctly.

  $ . "$TESTDIR/cgienv"
  $ PATH_INFO="/rev/$(python -c 'import sys; sys.stdout.buffer.write(b"\xe2\x80\x94")')"; export PATH_INFO
  $ QUERY_STRING="style=raw"; export QUERY_STRING
  $ "$PYTHON" ./hgweb.cgi | grep error
  error: unknown revision '\xe2\x80\x94' (esc)