Changed the test_stale tests to test_stale_opaque that also tests if the opaque value is still the same across the client authentication requests.
This commit is contained in:
parent
ff8ada129d
commit
177f549786
@ -108,8 +108,8 @@ class AuthenticationTestCase(TestCase):
|
||||
self.assertEqual(response.data.decode("UTF-8"),
|
||||
f"Hello, {_USERNAME}! #2")
|
||||
|
||||
def test_stale(self) -> None:
|
||||
"""Tests the stale value.
|
||||
def test_stale_opaque(self) -> None:
|
||||
"""Tests the stale and opaque value.
|
||||
|
||||
:return: None.
|
||||
"""
|
||||
@ -123,6 +123,7 @@ class AuthenticationTestCase(TestCase):
|
||||
www_authenticate = response.www_authenticate
|
||||
self.assertEqual(www_authenticate.type, "digest")
|
||||
self.assertEqual(www_authenticate.stale, None)
|
||||
opaque: str = www_authenticate.opaque
|
||||
|
||||
www_authenticate.nonce = "bad"
|
||||
auth_data = Client.make_authorization(
|
||||
@ -131,6 +132,7 @@ class AuthenticationTestCase(TestCase):
|
||||
self.assertEqual(response.status_code, 401)
|
||||
www_authenticate = response.www_authenticate
|
||||
self.assertEqual(www_authenticate.stale, True)
|
||||
self.assertEqual(www_authenticate.opaque, opaque)
|
||||
|
||||
auth_data = Client.make_authorization(
|
||||
www_authenticate, admin_uri, _USERNAME, _PASSWORD + "2")
|
||||
@ -138,6 +140,7 @@ class AuthenticationTestCase(TestCase):
|
||||
self.assertEqual(response.status_code, 401)
|
||||
www_authenticate = response.www_authenticate
|
||||
self.assertEqual(www_authenticate.stale, False)
|
||||
self.assertEqual(www_authenticate.opaque, opaque)
|
||||
|
||||
auth_data = Client.make_authorization(
|
||||
www_authenticate, admin_uri, _USERNAME, _PASSWORD)
|
||||
|
@ -143,8 +143,8 @@ class FlaskLoginTestCase(TestCase):
|
||||
self.assertEqual(response.data.decode("UTF-8"),
|
||||
f"Hello, {_USERNAME}! #2")
|
||||
|
||||
def test_stale(self) -> None:
|
||||
"""Tests the stale value.
|
||||
def test_stale_opaque(self) -> None:
|
||||
"""Tests the stale and opaque value.
|
||||
|
||||
:return: None.
|
||||
"""
|
||||
@ -161,6 +161,7 @@ class FlaskLoginTestCase(TestCase):
|
||||
www_authenticate = response.www_authenticate
|
||||
self.assertEqual(www_authenticate.type, "digest")
|
||||
self.assertEqual(www_authenticate.stale, None)
|
||||
opaque: str = www_authenticate.opaque
|
||||
|
||||
if hasattr(g, "_login_user"):
|
||||
delattr(g, "_login_user")
|
||||
@ -171,6 +172,7 @@ class FlaskLoginTestCase(TestCase):
|
||||
self.assertEqual(response.status_code, 401)
|
||||
www_authenticate = response.www_authenticate
|
||||
self.assertEqual(www_authenticate.stale, True)
|
||||
self.assertEqual(www_authenticate.opaque, opaque)
|
||||
|
||||
if hasattr(g, "_login_user"):
|
||||
delattr(g, "_login_user")
|
||||
@ -180,6 +182,7 @@ class FlaskLoginTestCase(TestCase):
|
||||
self.assertEqual(response.status_code, 401)
|
||||
www_authenticate = response.www_authenticate
|
||||
self.assertEqual(www_authenticate.stale, False)
|
||||
self.assertEqual(www_authenticate.opaque, opaque)
|
||||
|
||||
if hasattr(g, "_login_user"):
|
||||
delattr(g, "_login_user")
|
||||
|
Loading…
Reference in New Issue
Block a user