diff --git a/dcicutils/ff_utils.py b/dcicutils/ff_utils.py index 949d715e7..280bdc0df 100644 --- a/dcicutils/ff_utils.py +++ b/dcicutils/ff_utils.py @@ -994,8 +994,7 @@ def get_schema(name, key=None, ff_env: Optional[str] = None, portal_env: Optiona res = portal_vapp.get(full_url) return get_response_json(res) else: - auth = get_authentication_with_server(auth=key, ff_env=portal_env) - schema = get_metadata(obj_id=base_url, key=auth, add_on=add_on) + schema = get_metadata(obj_id=base_url, key=key, ff_env=portal_env, add_on=add_on) return schema @@ -1026,8 +1025,7 @@ def get_schemas(key=None, ff_env: Optional[str] = None, *, allow_abstract: bool full_url = f"{base_url}?{add_on}" schemas: Dict[str, Dict] = portal_vapp.get(full_url) else: - auth = get_authentication_with_server(auth=key, ff_env=portal_env) - schemas: Dict[str, Dict] = get_metadata(obj_id=base_url, key=auth, add_on=add_on) + schemas: Dict[str, Dict] = get_metadata(obj_id=base_url, key=key, ff_env=portal_env, add_on=add_on) filtered_schemas = {} for schema_name, schema in schemas.items(): if allow_abstract or not schema.get('isAbstract'): diff --git a/test/test_ff_utils.py b/test/test_ff_utils.py index 633772bab..16413a519 100644 --- a/test/test_ff_utils.py +++ b/test/test_ff_utils.py @@ -1348,8 +1348,8 @@ def test_get_schema_with_vapp(): # When called with no vapp, get_metadata is consulted (after getting auth info) assert ff_utils.get_schema('User', **env_args) == sample_schema_metadata - mock_get_authentication_with_server.assert_called_once_with(auth=None, ff_env=expected_env) - mock_get_metadata.assert_called_once_with(obj_id='profiles/User.json', key=sample_auth, + mock_get_authentication_with_server.assert_not_called() + mock_get_metadata.assert_called_once_with(obj_id='profiles/User.json', key=None, ff_env=expected_env, add_on='frame=raw') sample_vapp.get.assert_not_called() @@ -1398,11 +1398,10 @@ def test_get_schemas_with_vapp(): mock_get_metadata.return_value = sample_schema_metadata mock_get_authentication_with_server.return_value = sample_auth - # When called with no vapp, get_metadata is consulted (after getting auth info) assert ff_utils.get_schemas(**env_args) == sample_schema_metadata - mock_get_authentication_with_server.assert_called_once_with(auth=None, ff_env=expected_env) - mock_get_metadata.assert_called_once_with(obj_id='profiles/', key=sample_auth, + mock_get_authentication_with_server.assert_not_called() + mock_get_metadata.assert_called_once_with(obj_id='profiles/', key=None, ff_env=expected_env, add_on='frame=raw') sample_vapp.get.assert_not_called() @@ -1456,9 +1455,10 @@ def mocked_schemas_subset(keys): with mock.patch.object(ff_utils, "get_metadata") as mock_get_metadata: - def mocked_get_metadata(obj_id, key, add_on): + def mocked_get_metadata(obj_id, key, ff_env, add_on): assert obj_id == "profiles/" # this is the web API to ask for all profiles - assert key == 'some-auth' # we assume auth is tested elsewhere + assert key is None # it would get looked up + assert ff_env is None # it would get looked up, too assert add_on == "frame=raw" # we presently always send this return mocked_schemas