Created
April 8, 2021 15:13
-
-
Save skoranda/80a6e4b190ffad787ed5e6c534aed28d to your computer and use it in GitHub Desktop.
pytest -vv tests/dbgap_sync/test_user_sync.py::test_sync_in_login[google]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pytest -vv tests/dbgap_sync/test_user_sync.py::test_sync_in_login[google] | |
=============================================================== test session starts ================================================================ | |
platform linux -- Python 3.8.6, pytest-3.10.1, py-1.10.0, pluggy-0.13.1 -- /home/skoranda/CILogon2/BioCommons/GEN3/fence/venv/bin/python3 | |
cachedir: .pytest_cache | |
rootdir: /home/skoranda/CILogon2/BioCommons/GEN3/fence, inifile: | |
plugins: flask-0.11.0, cov-2.9.0 | |
collected 1 item | |
tests/dbgap_sync/test_user_sync.py::test_sync_in_login[google] FAILED [100%] | |
===================================================================== FAILURES ===================================================================== | |
____________________________________________________________ test_sync_in_login[google] ____________________________________________________________ | |
syncer = <fence.sync.sync_users.UserSyncer object at 0x7f72ae3e5160>, db_session = <sqlalchemy.orm.session.Session object at 0x7f72ae1f0ca0> | |
storage_client = <MagicMock id='140130524135376'> | |
rsa_private_key = '-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAr8OF4TG+sXeIuFQr+SvrqXxFMRbhlfp6RLGp6nejZCJUmCfw\noyK/A4cCOK7Z8de9Ld...zqyh5OwoykjdVYYL1df5IRQmVCL\nZJUOX+lCvegpVJcR++dTWAEfnvUiKYyBAysBIkzAMT9hX+2uQxHGeg==\n-----END RSA PRIVATE KEY-----\n' | |
kid = 'test-keypair', monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f72ae25e490> | |
@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) | |
tests/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 0x7f72ae2e8ad0>, state = <sqlalchemy.orm.state.InstanceState object at 0x7f72ae2c1610> | |
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 0x7f72ae4fde20> 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 setup --------------------------------------------------------------- | |
[2021-04-08 10:11:45,622][ fence][ INFO] Loading settings... | |
[2021-04-08 10:11:45,623][gen3config.config][ INFO] Opening default configuration... | |
[2021-04-08 10:11:45,666][gen3config.config][ INFO] Applying configuration: /home/skoranda/CILogon2/BioCommons/GEN3/fence/tests/test-fence-config.yaml | |
[2021-04-08 10:11:45,727][gen3config.config][WARNING] Did not provide key(s) dict_keys(['ENABLE_DB_MIGRATION', 'ENABLED_IDENTITY_PROVIDERS', 'SESSION_COOKIE_DOMAIN', 'TOKEN_PROJECTS_CUTOFF', 'RENEW_ACCESS_TOKEN_BEFORE_EXPIRATION', 'PRIVACY_POLICY_URL', 'GOOGLE_BULK_UPDATES', 'DATA_UPLOAD_BUCKET', 'GOOGLE_SERVICE_ACCOUNT_PREFIX', 'BILLING_PROJECT_FOR_SIGNED_URLS', 'BILLING_PROJECT_FOR_SA_CREDS', 'ENABLE_AUTOMATIC_BILLING_PERMISSION_SIGNED_URLS', 'ENABLE_AUTOMATIC_BILLING_PERMISSION_SA_CREDS', 'PROBLEM_USER_EMAIL_NOTIFICATION', 'ALLOWED_USER_SERVICE_ACCOUNT_DOMAINS', 'DREAM_CHALLENGE_TEAM', 'DREAM_CHALLENGE_GROUP', 'SYNAPSE_URI', 'SYNAPSE_JWKS_URI', 'SYNAPSE_DISCOVERY_URL', 'SYNAPSE_AUTHZ_TTL', 'RAS_REFRESH_EXPIRATION', 'SERVICE_ACCOUNT_LIMIT', 'USERSYNC']) in /home/skoranda/CILogon2/BioCommons/GEN3/fence/tests/test-fence-config.yaml. Will be set to default value(s) from /home/skoranda/CILogon2/BioCommons/GEN3/fence/fence/config-default.yaml. | |
[2021-04-08 10:11:45,756][ fence][WARNING] NOT enabling audit logs | |
[2021-04-08 10:11:45,785][ fence][WARNING] WARNING: no region for S3_BUCKET: bucket1. Providing the region will reduce response time and avoid a call to GetBucketLocation which you make lack the AWS ACLs for. | |
[2021-04-08 10:11:46,083][ fence][ INFO] Running database migration... | |
[2021-04-08 10:11:46,213][ fence][ INFO] Done running database migration. | |
--------------------------------------------------------------- Captured stdout call --------------------------------------------------------------- | |
[2021-04-08 10:11:46,429][user_syncer][ INFO] Got user project to arborist resource mapping: | |
{'test': '/programs/test/projects/test', 'test_program': '/programs/test_program'} | |
================================================================= warnings summary ================================================================= | |
tests/dbgap_sync/test_user_sync.py::test_sync_in_login[google] | |
/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") | |
-- Docs: https://docs.pytest.org/en/latest/warnings.html | |
======================================================= 1 failed, 1 warnings in 1.06 seconds ======================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment