chore: blacken (#375)
diff --git a/tests/test_app_engine.py b/tests/test_app_engine.py
index 70fa5ca..9559a2c 100644
--- a/tests/test_app_engine.py
+++ b/tests/test_app_engine.py
@@ -25,6 +25,7 @@
See https://cloud.google.com/appengine/docs/standard/python/refdocs
/google.appengine.api.app_identity.app_identity
"""
+
def get_application_id(self):
raise NotImplementedError()
@@ -41,10 +42,8 @@
@pytest.fixture
def app_identity(monkeypatch):
"""Mocks the app_identity module for google.auth.app_engine."""
- app_identity_module = mock.create_autospec(
- _AppIdentityModule, instance=True)
- monkeypatch.setattr(
- app_engine, 'app_identity', app_identity_module)
+ app_identity_module = mock.create_autospec(_AppIdentityModule, instance=True)
+ monkeypatch.setattr(app_engine, "app_identity", app_identity_module)
yield app_identity_module
@@ -57,13 +56,15 @@
with pytest.raises(EnvironmentError) as excinfo:
assert app_engine.get_project_id()
- assert excinfo.match(r'App Engine APIs are not available')
+ assert excinfo.match(r"App Engine APIs are not available")
class TestSigner(object):
def test_key_id(self, app_identity):
app_identity.sign_blob.return_value = (
- mock.sentinel.key_id, mock.sentinel.signature)
+ mock.sentinel.key_id,
+ mock.sentinel.signature,
+ )
signer = app_engine.Signer()
@@ -71,10 +72,12 @@
def test_sign(self, app_identity):
app_identity.sign_blob.return_value = (
- mock.sentinel.key_id, mock.sentinel.signature)
+ mock.sentinel.key_id,
+ mock.sentinel.signature,
+ )
signer = app_engine.Signer()
- to_sign = b'123'
+ to_sign = b"123"
signature = signer.sign(to_sign)
@@ -87,7 +90,7 @@
with pytest.raises(EnvironmentError) as excinfo:
app_engine.Credentials()
- assert excinfo.match(r'App Engine APIs are not available')
+ assert excinfo.match(r"App Engine APIs are not available")
def test_default_state(self, app_identity):
credentials = app_engine.Credentials()
@@ -106,52 +109,52 @@
assert not credentials.scopes
assert credentials.requires_scopes
- scoped_credentials = credentials.with_scopes(['email'])
+ scoped_credentials = credentials.with_scopes(["email"])
- assert scoped_credentials.has_scopes(['email'])
+ assert scoped_credentials.has_scopes(["email"])
assert not scoped_credentials.requires_scopes
def test_service_account_email_implicit(self, app_identity):
app_identity.get_service_account_name.return_value = (
- mock.sentinel.service_account_email)
+ mock.sentinel.service_account_email
+ )
credentials = app_engine.Credentials()
- assert (credentials.service_account_email ==
- mock.sentinel.service_account_email)
+ assert credentials.service_account_email == mock.sentinel.service_account_email
assert app_identity.get_service_account_name.called
def test_service_account_email_explicit(self, app_identity):
credentials = app_engine.Credentials(
- service_account_id=mock.sentinel.service_account_email)
+ service_account_id=mock.sentinel.service_account_email
+ )
- assert (credentials.service_account_email ==
- mock.sentinel.service_account_email)
+ assert credentials.service_account_email == mock.sentinel.service_account_email
assert not app_identity.get_service_account_name.called
- @mock.patch(
- 'google.auth._helpers.utcnow',
- return_value=datetime.datetime.min)
+ @mock.patch("google.auth._helpers.utcnow", return_value=datetime.datetime.min)
def test_refresh(self, utcnow, app_identity):
- token = 'token'
+ token = "token"
ttl = 643942923
app_identity.get_access_token.return_value = token, ttl
- credentials = app_engine.Credentials(scopes=['email'])
+ credentials = app_engine.Credentials(scopes=["email"])
credentials.refresh(None)
app_identity.get_access_token.assert_called_with(
- credentials.scopes, credentials._service_account_id)
+ credentials.scopes, credentials._service_account_id
+ )
assert credentials.token == token
- assert credentials.expiry == datetime.datetime(
- 1990, 5, 29, 1, 2, 3)
+ assert credentials.expiry == datetime.datetime(1990, 5, 29, 1, 2, 3)
assert credentials.valid
assert not credentials.expired
def test_sign_bytes(self, app_identity):
app_identity.sign_blob.return_value = (
- mock.sentinel.key_id, mock.sentinel.signature)
+ mock.sentinel.key_id,
+ mock.sentinel.signature,
+ )
credentials = app_engine.Credentials()
- to_sign = b'123'
+ to_sign = b"123"
signature = credentials.sign_bytes(to_sign)