Accept sha256 hash for swift tempurl

Since swiftclient 4.0.1, sha256 is used when generating tempurl
signature[1].
This change extends the regex pattern to assert signatues so that it
can accept both sha1(old) and sha256(current).

[1] https://review.opendev.org/c/openstack/python-swiftclient/+/845157

Change-Id: I1589adbe4501b1c678f197b9c0f67b716c341b2d
This commit is contained in:
Takashi Kajinami 2022-07-18 13:51:43 +09:00
parent 6b72237c7a
commit 69d4a5ee93
1 changed files with 1 additions and 1 deletions

View File

@ -292,7 +292,7 @@ class TempURLSignalTest(testtools.TestCase):
url = deployment_utils.create_temp_url(swift_client, 'bar', 60)
self.assertFalse(swift_client.post_account.called)
regexp = (r"http://fake-host.com:8080/v1/AUTH_demo/bar-%s"
r"/%s\?temp_url_sig=[0-9a-f]{40}&"
r"/%s\?temp_url_sig=[0-9a-f]{40,64}&"
r"temp_url_expires=[0-9]{10}" % (uuid_pattern, uuid_pattern))
self.assertThat(url, matchers.MatchesRegex(regexp))