-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/arborist #138
Feat/arborist #138
Conversation
This comment has been minimized.
This comment has been minimized.
26a0ebd
to
11c08ef
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 some minor comments + pending integration tests
tests/conftest.py
Outdated
""" | ||
This fixture returns a function which you call to mock the call to | ||
arborist client's methods. | ||
Parameter "mapping" lets us specify the response for a call to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auth_mapping
tests/conftest.py
Outdated
mocked_response = MagicMock(requests.Response) | ||
|
||
if function_name == "auth_mapping": | ||
def mocked_items(*args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary
tests/conftest.py
Outdated
if function_name == "create_resource": | ||
def mocked_get(*args, **kwargs): | ||
return None | ||
mocked_response.get = mocked_get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mocked_response.get = lambda *args, **kwargs: None
? :D :D
peregrine/auth/__init__.py
Outdated
|
||
def resource_path_to_project_ids(resource_path): | ||
parts = resource_path.strip('/').split('/') | ||
if resource_path == "/" or (parts and parts[0] == "programs"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we instead make this if not blah: early return
, so that the rest of the fn need not be indented --> control flow is easier to read?
Also: I don't think parts
will ever be empty, since (1) the separator is specified and (2) resource_path
is not None
(otherwise previous line will fail). But not a big deal either way
So maybe
if not (parts[0] == "programs" or resource_path == "/"):
log bad resource path?
return []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thank you!!
except it's not a bad resource path, it's just ignored by peregrine (eg /data_upload or /consent/xxx)
1afa46d
to
aead65c
Compare
run.py
so that gen3authz requests are mocked when we run peregrine locallyproject_access
from the test user tokensrandom_user
fixture (only keepsubmitter
andadmin
) since authorization doesn't depend on project access in the token anymoretests/auth_mock.py
Breaking Changes
Dependency updates
Deployment changes