Update tests to work with WebOb 1.8.1

WebOb recently changed how they validate Accept-* headers [0] to
closely follow the definitions in RFC 7231 Section 5.3.2 [1].

WebOb now checks the actual value of the Accept-Language header and
compares it to a regular expression. This caused a couple keystone
unit tests to fail because we were generating random UUIDs for
Accept-Language testing just to make sure the logic within keystone
was behaving properly. The UUID format actual fails the new regular
expression being used by WebOb to validate the Accept-Language
header.

This commit changes the tests to use a language header that passes
the new validation put in place by WebOb.

[0] https://docs.pylonsproject.org/projects/webob/en/stable/whatsnew-1.8.html#backwards-incompatibilities
[1] https://tools.ietf.org/html/rfc7231.html#section-5.3.2

Change-Id: Ic53f4d00bc6c8dec08ec1bff589a91ff359276e1
Closes-Bug: 1765748
This commit is contained in:
Lance Bragstad 2018-05-14 14:29:52 +00:00
parent 6bb59948e9
commit f37895dc59
1 changed files with 2 additions and 2 deletions

View File

@ -520,7 +520,7 @@ class LocalizedResponseTest(unit.TestCase):
# If Accept-Language is a supported language, best_match_language()
# returns it.
language = uuid.uuid4().hex
language = 'bogus'
mock_gal.return_value = [language]
req = webob.Request.blank('/', headers={'Accept-Language': language})
@ -551,7 +551,7 @@ class LocalizedResponseTest(unit.TestCase):
# and an exception is raised by the application that is translatable
# then the response will have the translated message.
language = uuid.uuid4().hex
language = 'bogus'
mock_gal.return_value = [language]
# The arguments for the xlated message format have to match the args