Skip to content

Commit ad1eca6

Browse files
Merge pull request #317 from Rotzbua/chore_migration
chore(migration): use f-string
2 parents dd7b062 + af386f9 commit ad1eca6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

knox/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Meta:
4949
abstract = True
5050

5151
def __str__(self) -> str:
52-
return '%s : %s' % (self.digest, self.user)
52+
return f'{self.digest} : {self.user}'
5353

5454

5555
class AuthToken(AbstractAuthToken):

tests/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
def get_basic_auth_header(username, password):
2525
return 'Basic %s' % base64.b64encode(
26-
('%s:%s' % (username, password)).encode('ascii')).decode()
26+
(f'{username}:{password}').encode('ascii')).decode()
2727

2828

2929
auto_refresh_knox = knox_settings.defaults.copy()
@@ -198,7 +198,7 @@ def test_update_token_key(self):
198198
instance, token = AuthToken.objects.create(self.user)
199199
rf = APIRequestFactory()
200200
request = rf.get('/')
201-
request.META = {'HTTP_AUTHORIZATION': 'Token {}'.format(token)}
201+
request.META = {'HTTP_AUTHORIZATION': f'Token {token}'}
202202
(self.user, auth_token) = TokenAuthentication().authenticate(request)
203203
self.assertEqual(
204204
token[:CONSTANTS.TOKEN_KEY_LENGTH],

0 commit comments

Comments
 (0)