diff --git a/knox/models.py b/knox/models.py index 80929bcf..32f95ea4 100644 --- a/knox/models.py +++ b/knox/models.py @@ -49,7 +49,7 @@ class Meta: abstract = True def __str__(self) -> str: - return '%s : %s' % (self.digest, self.user) + return f'{self.digest} : {self.user}' class AuthToken(AbstractAuthToken): diff --git a/tests/tests.py b/tests/tests.py index 6fa5ca97..9494db0b 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -23,7 +23,7 @@ def get_basic_auth_header(username, password): return 'Basic %s' % base64.b64encode( - ('%s:%s' % (username, password)).encode('ascii')).decode() + (f'{username}:{password}').encode('ascii')).decode() auto_refresh_knox = knox_settings.defaults.copy() @@ -198,7 +198,7 @@ def test_update_token_key(self): instance, token = AuthToken.objects.create(self.user) rf = APIRequestFactory() request = rf.get('/') - request.META = {'HTTP_AUTHORIZATION': 'Token {}'.format(token)} + request.META = {'HTTP_AUTHORIZATION': f'Token {token}'} (self.user, auth_token) = TokenAuthentication().authenticate(request) self.assertEqual( token[:CONSTANTS.TOKEN_KEY_LENGTH],