Revised the test_stale_opaque tests of the AuthenticationTestCase and FlaskLoginTestCase test cases to use the super method instead of the overridden method of the Client class.

This commit is contained in:
依瑪貓 2022-11-25 00:18:43 +11:00
parent 177f549786
commit dda8472a76
2 changed files with 8 additions and 8 deletions

View File

@ -118,7 +118,7 @@ class AuthenticationTestCase(TestCase):
www_authenticate: WWWAuthenticate
auth_data: Authorization
response = self.client.get(admin_uri)
response = super(Client, self.client).get(admin_uri)
self.assertEqual(response.status_code, 401)
www_authenticate = response.www_authenticate
self.assertEqual(www_authenticate.type, "digest")
@ -128,7 +128,7 @@ class AuthenticationTestCase(TestCase):
www_authenticate.nonce = "bad"
auth_data = Client.make_authorization(
www_authenticate, admin_uri, _USERNAME, _PASSWORD)
response = self.client.get(admin_uri, auth=auth_data)
response = super(Client, self.client).get(admin_uri, auth=auth_data)
self.assertEqual(response.status_code, 401)
www_authenticate = response.www_authenticate
self.assertEqual(www_authenticate.stale, True)
@ -136,7 +136,7 @@ class AuthenticationTestCase(TestCase):
auth_data = Client.make_authorization(
www_authenticate, admin_uri, _USERNAME, _PASSWORD + "2")
response = self.client.get(admin_uri, auth=auth_data)
response = super(Client, self.client).get(admin_uri, auth=auth_data)
self.assertEqual(response.status_code, 401)
www_authenticate = response.www_authenticate
self.assertEqual(www_authenticate.stale, False)
@ -144,5 +144,5 @@ class AuthenticationTestCase(TestCase):
auth_data = Client.make_authorization(
www_authenticate, admin_uri, _USERNAME, _PASSWORD)
response = self.client.get(admin_uri, auth=auth_data)
response = super(Client, self.client).get(admin_uri, auth=auth_data)
self.assertEqual(response.status_code, 200)

View File

@ -156,7 +156,7 @@ class FlaskLoginTestCase(TestCase):
www_authenticate: WWWAuthenticate
auth_data: Authorization
response = self.client.get(admin_uri)
response = super(Client, self.client).get(admin_uri)
self.assertEqual(response.status_code, 401)
www_authenticate = response.www_authenticate
self.assertEqual(www_authenticate.type, "digest")
@ -168,7 +168,7 @@ class FlaskLoginTestCase(TestCase):
www_authenticate.nonce = "bad"
auth_data = Client.make_authorization(
www_authenticate, admin_uri, _USERNAME, _PASSWORD)
response = self.client.get(admin_uri, auth=auth_data)
response = super(Client, self.client).get(admin_uri, auth=auth_data)
self.assertEqual(response.status_code, 401)
www_authenticate = response.www_authenticate
self.assertEqual(www_authenticate.stale, True)
@ -178,7 +178,7 @@ class FlaskLoginTestCase(TestCase):
delattr(g, "_login_user")
auth_data = Client.make_authorization(
www_authenticate, admin_uri, _USERNAME, _PASSWORD + "2")
response = self.client.get(admin_uri, auth=auth_data)
response = super(Client, self.client).get(admin_uri, auth=auth_data)
self.assertEqual(response.status_code, 401)
www_authenticate = response.www_authenticate
self.assertEqual(www_authenticate.stale, False)
@ -188,5 +188,5 @@ class FlaskLoginTestCase(TestCase):
delattr(g, "_login_user")
auth_data = Client.make_authorization(
www_authenticate, admin_uri, _USERNAME, _PASSWORD)
response = self.client.get(admin_uri, auth=auth_data)
response = super(Client, self.client).get(admin_uri, auth=auth_data)
self.assertEqual(response.status_code, 200)