python: Manually convert more percent-formatting to f-strings.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-06-13 17:57:50 -07:00
committed by Tim Abbott
parent 3461db7ef5
commit 5dc9b55c43
44 changed files with 223 additions and 194 deletions

View File

@@ -819,8 +819,7 @@ class SocialAuthBase(DesktopFlowTestingLib, ZulipTestCase):
expected_result_url_prefix = f'http://testserver/login/{self.backend.name}/'
if settings.SOCIAL_AUTH_SUBDOMAIN is not None:
expected_result_url_prefix = ('http://%s.testserver/login/%s/' %
(settings.SOCIAL_AUTH_SUBDOMAIN, self.backend.name))
expected_result_url_prefix = f'http://{settings.SOCIAL_AUTH_SUBDOMAIN}.testserver/login/{self.backend.name}/'
if result.status_code != 302 or not result.url.startswith(expected_result_url_prefix):
return result
@@ -1773,8 +1772,8 @@ class SAMLAuthBackendTest(SocialAuthBase):
self.assertEqual(result.status_code, 302)
self.assertEqual('/login/', result.url)
self.assertEqual(m.output, [self.logger_output(
'/complete/saml/: Authentication request with IdP %s but this provider is not enabled '
'for this subdomain %s.' % ("test_idp", "zephyr"), 'info',
'/complete/saml/: Authentication request with IdP test_idp but this provider is not enabled '
'for this subdomain zephyr.', 'info',
)])
def test_social_auth_saml_login_bad_idp_arg(self) -> None:
@@ -1908,7 +1907,7 @@ class SAMLAuthBackendTest(SocialAuthBase):
self.assertEqual(result.status_code, 302)
self.assertEqual('/login/', result.url)
self.assertEqual(m.output, [self.logger_output(
"/complete/saml/: Can't figure out subdomain for this authentication request. relayed_params: %s" % {},
"/complete/saml/: Can't figure out subdomain for this authentication request. relayed_params: {}",
"info",
)])
@@ -2598,8 +2597,8 @@ class GitHubAuthBackendTest(SocialAuthBase):
self.assertEqual(result.status_code, 302)
self.assertEqual(result.url, "/login/")
self.assertEqual(m.output, [self.logger_output(
"Social auth (%s) failed because user has no verified"
" emails associated with the account" % ("GitHub",),
"Social auth (GitHub) failed because user has no verified"
" emails associated with the account",
"warning",
)])
@@ -2622,8 +2621,8 @@ class GitHubAuthBackendTest(SocialAuthBase):
self.assertEqual(result.status_code, 302)
self.assertEqual(result.url, "/login/")
self.assertEqual(m.output, [self.logger_output(
"Social auth (%s) failed because user has no verified"
" emails associated with the account" % ("GitHub",),
"Social auth (GitHub) failed because user has no verified"
" emails associated with the account",
"warning",
)])