mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Fix pytest.raises compat issue
This commit is contained in:
parent
24c18fc3d6
commit
07b380b88c
|
@ -535,9 +535,9 @@ class BasicAuthenticationUnitTests(TestCase):
|
||||||
authentication.authenticate = lambda **kwargs: MockUser()
|
authentication.authenticate = lambda **kwargs: MockUser()
|
||||||
try:
|
try:
|
||||||
auth = authentication.BasicAuthentication()
|
auth = authentication.BasicAuthentication()
|
||||||
with pytest.raises(exceptions.AuthenticationFailed) as error:
|
with pytest.raises(exceptions.AuthenticationFailed) as exc_info:
|
||||||
auth.authenticate_credentials('foo', 'bar')
|
auth.authenticate_credentials('foo', 'bar')
|
||||||
assert 'User inactive or deleted.' in str(error)
|
assert 'User inactive or deleted.' in str(exc_info.value)
|
||||||
finally:
|
finally:
|
||||||
authentication.authenticate = old_authenticate
|
authentication.authenticate = old_authenticate
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user