Skip to content

Commit

Permalink
chore(migration): use f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotzbua committed Jan 27, 2024
1 parent dd7b062 commit af386f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion knox/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'

Check warning on line 52 in knox/models.py

View check run for this annotation

Codecov / codecov/patch

knox/models.py#L52

Added line #L52 was not covered by tests


class AuthToken(AbstractAuthToken):
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit af386f9

Please sign in to comment.