mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
Added abc.abstractmethod decorator to BaseAuthentication.authenticate and fixed tests for the same.
This commit is contained in:
parent
6607c63483
commit
58151b4bde
|
@ -36,6 +36,7 @@ class BaseAuthentication(abc.ABC):
|
||||||
All authentication classes should extend BaseAuthentication.
|
All authentication classes should extend BaseAuthentication.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def authenticate(self, request):
|
def authenticate(self, request):
|
||||||
"""
|
"""
|
||||||
Authenticate the request and return a two-tuple of (user, token).
|
Authenticate the request and return a two-tuple of (user, token).
|
||||||
|
|
|
@ -537,7 +537,7 @@ class NoAuthenticationClassesTests(TestCase):
|
||||||
class BasicAuthenticationUnitTests(TestCase):
|
class BasicAuthenticationUnitTests(TestCase):
|
||||||
|
|
||||||
def test_base_authentication_abstract_method(self):
|
def test_base_authentication_abstract_method(self):
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(TypeError):
|
||||||
BaseAuthentication().authenticate({})
|
BaseAuthentication().authenticate({})
|
||||||
|
|
||||||
def test_basic_authentication_raises_error_if_user_not_found(self):
|
def test_basic_authentication_raises_error_if_user_not_found(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user