From 1fa7bf7434a95cc68ffeace7d02fa03a0b245734 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Sun, 17 Dec 2023 19:52:18 +0100 Subject: [PATCH] chore(migration): use f-string --- knox/models.py | 2 +- tests/tests.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/knox/models.py b/knox/models.py index b054f289..8b90eda4 100644 --- a/knox/models.py +++ b/knox/models.py @@ -49,7 +49,7 @@ class Meta: abstract = True def __str__(self): - 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],