Skip to content

Instantly share code, notes, and snippets.

@skoranda
Last active April 8, 2021 14:49
Show Gist options
  • Save skoranda/d4ea9f6480def989cf8d19e92b342be3 to your computer and use it in GitHub Desktop.
Save skoranda/d4ea9f6480def989cf8d19e92b342be3 to your computer and use it in GitHub Desktop.
test_sync_in_login[google]
========================================== FAILURES ==========================================
_________________________________ test_sync_in_login[google] _________________________________
syncer = <fence.sync.sync_users.UserSyncer object at 0x7f01554c3790>
db_session = <sqlalchemy.orm.session.Session object at 0x7f01551d5220>
storage_client = <MagicMock id='139643754483616'>
rsa_private_key = '-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEAziwKb8/ZvGYUeYKeaE4N1KpHVikYwllulx+ZuIxH2aGm7aqq\nNy5fv1KYjBDOUsysdG...SS+rNG1fY8iQX5GDkscw2kWDyxB\nhhquMDIfed+ZbnrO1qRiB5zkLu7ydbLxxSDPRvxi8QqkAcv6bwhOx5o=\n-----END RSA PRIVATE KEY-----\n'
kid = 'test-keypair', monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f01552418b0>
@pytest.mark.parametrize("syncer", ["google"], indirect=True)
def test_sync_in_login(
syncer,
db_session,
storage_client,
rsa_private_key,
kid,
monkeypatch,
):
user = models.query_for_user(
session=db_session, username="TESTUSERB"
) # contains no information
assert len(user.project_access) == 0
db_session.close()
> syncer.sync_single_user_visas(user, db_session)
dbgap_sync/test_user_sync.py:744:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../fence/sync/sync_users.py:2095: in sync_single_user_visas
for visa in user.ga4gh_visas_v1:
../venv/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py:294: in __get__
return self.impl.get(instance_state(instance), dict_)
../venv/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py:730: in get
value = self.callable_(state, passive)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sqlalchemy.orm.strategies.LazyLoader object at 0x7f01568fa520>
state = <sqlalchemy.orm.state.InstanceState object at 0x7f0155430220>
passive = symbol('PASSIVE_OFF')
def _load_for_state(self, state, passive):
if not state.key and (
(
not self.parent_property.load_on_pending
and not state._load_pending
)
or not state.session_id
):
return attributes.ATTR_EMPTY
pending = not state.key
primary_key_identity = None
if (not passive & attributes.SQL_OK and not self.use_get) or (
not passive & attributes.NON_PERSISTENT_OK and pending
):
return attributes.PASSIVE_NO_RESULT
if (
# we were given lazy="raise"
self._raise_always
# the no_raise history-related flag was not passed
and not passive & attributes.NO_RAISE
and (
# if we are use_get and related_object_ok is disabled,
# which means we are at most looking in the identity map
# for history purposes or otherwise returning
# PASSIVE_NO_RESULT, don't raise. This is also a
# history-related flag
not self.use_get
or passive & attributes.RELATED_OBJECT_OK
)
):
self._invoke_raise_load(state, passive, "raise")
session = _state_session(state)
if not session:
if passive & attributes.NO_RAISE:
return attributes.PASSIVE_NO_RESULT
> raise orm_exc.DetachedInstanceError(
"Parent instance %s is not bound to a Session; "
"lazy load operation of attribute '%s' cannot proceed"
% (orm_util.state_str(state), self.key)
)
E sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <User at 0x7f015549c760> is not bound to a Session; lazy load operation of attribute 'ga4gh_visas_v1' cannot proceed (Background on this error at: http://sqlalche.me/e/13/bhk3)
../venv/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py:717: DetachedInstanceError
------------------------------------ Captured stdout call ------------------------------------
[2021-04-08 09:46:40,849][user_syncer][ INFO] Got user project to arborist resource mapping:
{'test': '/programs/test/projects/test', 'test_program': '/programs/test_program'}
====================================== warnings summary ======================================
test_audit_service.py::test_presigned_url_log[gs-s3_and_gs]
/home/skoranda/CILogon2/BioCommons/GEN3/fence/fence/resources/audit_service_client.py:34: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
logger.warn("NOT enabling audit logs")
google/test_google_monitor.py::test_validation_check_service_account_removed
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py:1359: SAWarning: DELETE statement on table 'service_account_access_privilege' expected to delete 1 row(s); 0 were matched. Please set confirm_deleted_rows=False within the mapper configuration to prevent this warning.
util.warn(
jwt/test_blacklist.py::test_normal_token_not_blacklisted
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jwt.py:77: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jws.py:141: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
rfc6749/test_oauth2.py::test_oauth2_token_post_revoke
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jwt.py:77: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jws.py:141: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
rfc6749/test_revoke.py::test_blacklisted_token
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jwt.py:77: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jws.py:141: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jwt.py:77: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jws.py:141: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
rfc6749/test_revoke.py::test_cannot_revoke_access_token
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jwt.py:77: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
/home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/lib/python3.8/site-packages/jwt/api_jws.py:141: DeprecationWarning: It is strongly recommended that you pass in a value for the "algorithms" argument when calling decode(). This argument will be mandatory in a future version.
warnings.warn(
-- Docs: https://docs.pytest.org/en/latest/warnings.html
=============== 1 failed, 457 passed, 14 skipped, 12 warnings in 77.21 seconds ===============
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment