diff options
author | Hugo <hugovk@users.noreply.github.com> | 2019-08-14 23:44:51 +0300 |
---|---|---|
committer | Hugo <hugovk@users.noreply.github.com> | 2019-08-15 12:24:33 +0300 |
commit | 2cec2adf8f54c9eda2a2674f565584aea709ef8a (patch) | |
tree | 5d965388d9b02f6b82cba84a53dd55ff979e45e2 /tests/oauth2 | |
parent | 3718a0e048e64994c2ee3819c5e5ed218a05f115 (diff) | |
download | oauthlib-2cec2adf8f54c9eda2a2674f565584aea709ef8a.tar.gz |
Upgrade Python syntax with pyupgrade
Diffstat (limited to 'tests/oauth2')
-rw-r--r-- | tests/oauth2/rfc6749/clients/test_base.py | 4 | ||||
-rw-r--r-- | tests/oauth2/rfc6749/clients/test_legacy_application.py | 6 | ||||
-rw-r--r-- | tests/oauth2/rfc6749/clients/test_web_application.py | 2 | ||||
-rw-r--r-- | tests/oauth2/rfc6749/test_parameters.py | 10 |
4 files changed, 11 insertions, 11 deletions
diff --git a/tests/oauth2/rfc6749/clients/test_base.py b/tests/oauth2/rfc6749/clients/test_base.py index d48a944..4fbada9 100644 --- a/tests/oauth2/rfc6749/clients/test_base.py +++ b/tests/oauth2/rfc6749/clients/test_base.py @@ -295,11 +295,11 @@ class ClientTest(TestCase): u, h, b = client.prepare_refresh_token_request(url, token, scope=scope) self.assertEqual(u, url) self.assertEqual(h, {'Content-Type': 'application/x-www-form-urlencoded'}) - self.assertFormBodyEqual(b, 'grant_type=refresh_token&scope=%s&refresh_token=%s' % (scope, token)) + self.assertFormBodyEqual(b, 'grant_type=refresh_token&scope={}&refresh_token={}'.format(scope, token)) # provide scope while init client = Client(self.client_id, scope=scope) u, h, b = client.prepare_refresh_token_request(url, token, scope=scope) self.assertEqual(u, url) self.assertEqual(h, {'Content-Type': 'application/x-www-form-urlencoded'}) - self.assertFormBodyEqual(b, 'grant_type=refresh_token&scope=%s&refresh_token=%s' % (scope, token)) + self.assertFormBodyEqual(b, 'grant_type=refresh_token&scope={}&refresh_token={}'.format(scope, token)) diff --git a/tests/oauth2/rfc6749/clients/test_legacy_application.py b/tests/oauth2/rfc6749/clients/test_legacy_application.py index 21af4a3..01e46e4 100644 --- a/tests/oauth2/rfc6749/clients/test_legacy_application.py +++ b/tests/oauth2/rfc6749/clients/test_legacy_application.py @@ -32,7 +32,7 @@ class LegacyApplicationClientTest(TestCase): password = "user_password" body = "not=empty" - body_up = "not=empty&grant_type=password&username=%s&password=%s" % (username, password) + body_up = "not=empty&grant_type=password&username={}&password={}".format(username, password) body_kwargs = body_up + "&some=providers&require=extra+arguments" token_json = ('{ "access_token":"2YotnFZFEjr1zCsicMWpAA",' @@ -105,8 +105,8 @@ class LegacyApplicationClientTest(TestCase): # scenario 1, default behavior to not include `client_id` r1 = client.prepare_request_body(username=self.username, password=self.password) - self.assertIn(r1, ('grant_type=password&username=%s&password=%s' % (self.username, self.password, ), - 'grant_type=password&password=%s&username=%s' % (self.password, self.username, ), + self.assertIn(r1, ('grant_type=password&username={}&password={}'.format(self.username, self.password), + 'grant_type=password&password={}&username={}'.format(self.password, self.username), )) # scenario 2, include `client_id` in the body diff --git a/tests/oauth2/rfc6749/clients/test_web_application.py b/tests/oauth2/rfc6749/clients/test_web_application.py index 092f93e..f7fbb02 100644 --- a/tests/oauth2/rfc6749/clients/test_web_application.py +++ b/tests/oauth2/rfc6749/clients/test_web_application.py @@ -46,7 +46,7 @@ class WebApplicationClientTest(TestCase): code = "zzzzaaaa" body = "not=empty" - body_code = "not=empty&grant_type=authorization_code&code=%s&client_id=%s" % (code, client_id) + body_code = "not=empty&grant_type=authorization_code&code={}&client_id={}".format(code, client_id) body_redirect = body_code + "&redirect_uri=http%3A%2F%2Fmy.page.com%2Fcallback" body_kwargs = body_code + "&some=providers&require=extra+arguments" diff --git a/tests/oauth2/rfc6749/test_parameters.py b/tests/oauth2/rfc6749/test_parameters.py index 48b7eac..5e449f4 100644 --- a/tests/oauth2/rfc6749/test_parameters.py +++ b/tests/oauth2/rfc6749/test_parameters.py @@ -77,9 +77,9 @@ class ParameterTests(TestCase): error_invalid = 'https://client.example.com/cb?error=invalid_request&state=xyz' implicit_base = 'https://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA&scope=abc&' - implicit_response = implicit_base + 'state={0}&token_type=example&expires_in=3600'.format(state) - implicit_notype = implicit_base + 'state={0}&expires_in=3600'.format(state) - implicit_wrongstate = implicit_base + 'state={0}&token_type=exampleexpires_in=3600'.format('invalid') + implicit_response = implicit_base + 'state={}&token_type=example&expires_in=3600'.format(state) + implicit_notype = implicit_base + 'state={}&expires_in=3600'.format(state) + implicit_wrongstate = implicit_base + 'state={}&token_type=exampleexpires_in=3600'.format('invalid') implicit_nostate = implicit_base + 'token_type=example&expires_in=3600' implicit_notoken = 'https://example.com/cb#state=xyz&token_type=example&expires_in=3600' @@ -244,7 +244,7 @@ class ParameterTests(TestCase): for scope in new + old: self.assertIn(scope, message) self.assertEqual(old, ['aaa']) - self.assertEqual(set(new), set(['abc', 'def'])) + self.assertEqual(set(new), {'abc', 'def'}) finally: signals.scope_changed.disconnect(record_scope_change) del os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] @@ -278,7 +278,7 @@ class ParameterTests(TestCase): for scope in new + old: self.assertIn(scope, message) self.assertEqual(old, ['aaa']) - self.assertEqual(set(new), set(['abc', 'def'])) + self.assertEqual(set(new), {'abc', 'def'}) finally: signals.scope_changed.disconnect(record_scope_change) del os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] |