Added abc.abstractmethod decorator to BaseAuthentication.authenticate and fixed tests for the same.

This commit is contained in:
mentix02 2020-06-11 17:02:00 -07:00
parent 6607c63483
commit 58151b4bde
2 changed files with 2 additions and 1 deletions

View File

@ -36,6 +36,7 @@ class BaseAuthentication(abc.ABC):
All authentication classes should extend BaseAuthentication.
"""
@abc.abstractmethod
def authenticate(self, request):
"""
Authenticate the request and return a two-tuple of (user, token).

View File

@ -537,7 +537,7 @@ class NoAuthenticationClassesTests(TestCase):
class BasicAuthenticationUnitTests(TestCase):
def test_base_authentication_abstract_method(self):
with pytest.raises(NotImplementedError):
with pytest.raises(TypeError):
BaseAuthentication().authenticate({})
def test_basic_authentication_raises_error_if_user_not_found(self):