Add comments to clarify change to www-authenticate test
Trivial patch to tidy-up change to the functional test for www-authenticate header and add a comment to explain that multiple header values might be returned. Change-Id: If62cb3fd9e11450a2be0cec71e80ecb74a959d04 Related-bug: 1368048
This commit is contained in:
parent
1f02740197
commit
a03732e142
@ -270,6 +270,8 @@ class TestAccount(Base):
|
|||||||
containers)
|
containers)
|
||||||
|
|
||||||
def testQuotedWWWAuthenticateHeader(self):
|
def testQuotedWWWAuthenticateHeader(self):
|
||||||
|
# check that the www-authenticate header value with the swift realm
|
||||||
|
# is correctly quoted.
|
||||||
conn = Connection(tf.config)
|
conn = Connection(tf.config)
|
||||||
conn.authenticate()
|
conn.authenticate()
|
||||||
inserted_html = '<b>Hello World'
|
inserted_html = '<b>Hello World'
|
||||||
@ -279,9 +281,13 @@ class TestAccount(Base):
|
|||||||
conn.connection.request('GET', '/v1/' + quoted_hax, None, {})
|
conn.connection.request('GET', '/v1/' + quoted_hax, None, {})
|
||||||
resp = conn.connection.getresponse()
|
resp = conn.connection.getresponse()
|
||||||
resp_headers = dict(resp.getheaders())
|
resp_headers = dict(resp.getheaders())
|
||||||
self.assertTrue('www-authenticate' in resp_headers, resp_headers)
|
self.assertTrue('www-authenticate' in resp_headers,
|
||||||
|
'www-authenticate not found in %s' % resp_headers)
|
||||||
actual = resp_headers['www-authenticate']
|
actual = resp_headers['www-authenticate']
|
||||||
expected = 'Swift realm="%s"' % quoted_hax
|
expected = 'Swift realm="%s"' % quoted_hax
|
||||||
|
# other middleware e.g. auth_token may also set www-authenticate
|
||||||
|
# headers in which case actual values will be a comma separated list.
|
||||||
|
# check that expected value is among the actual values
|
||||||
self.assertTrue(expected in actual,
|
self.assertTrue(expected in actual,
|
||||||
'%s not found in %s' % (expected, actual))
|
'%s not found in %s' % (expected, actual))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user