nova/nova/tests/unit/console
melanie witt 15769b883e Adapt websocketproxy tests for SimpleHTTPServer fix
In response to bug 1927677 we added a workaround to
NovaProxyRequestHandler to respond with a 400 Bad Request if an open
redirect is attempted:

  Ie36401c782f023d1d5f2623732619105dc2cfa24
  I95f68be76330ff09e5eabb5ef8dd9a18f5547866

Recently in python 3.10.6, a fix has landed in cpython to respond with
a 301 Moved Permanently to a sanitized URL that has had extra leading
'/' characters removed.

This breaks our existing unit tests which assume a 400 Bad Request as
the only expected response.

This adds handling of a 301 Moved Permanently response and asserts that
the redirect location is the expected sanitized URL. Doing this instead
of checking for a given python version will enable the tests to continue
to work if and when the cpython fix gets backported to older python
versions.

While updating the tests, the opportunity was taken to commonize the
code of two unit tests that were nearly identical.

Related-Bug: #1927677
Closes-Bug: #1986545

Change-Id: I27441d15cc6fa2ff7715ba15aa900961aadbf54a
2022-08-17 00:08:57 +00:00
..
rfb Use unittest.mock instead of third party mock 2022-08-01 17:46:26 +02:00
securityproxy Use unittest.mock instead of third party mock 2022-08-01 17:46:26 +02:00
__init__.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
test_serial.py Use unittest.mock instead of third party mock 2022-08-01 17:46:26 +02:00
test_type.py Make unit tests inherit from test.NoDBTestCase 2015-03-06 09:46:31 +02:00
test_websocketproxy.py Adapt websocketproxy tests for SimpleHTTPServer fix 2022-08-17 00:08:57 +00:00