-
Notifications
You must be signed in to change notification settings - Fork 3
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
✨Study file resource #197
✨Study file resource #197
Conversation
_links = ma.Hyperlinks({ | ||
'self': ma.URLFor(Meta.resource_url, kf_id='<kf_id>'), | ||
'collection': ma.URLFor(Meta.collection_url), | ||
'study_files': ma.URLFor('api.studies', kf_id='<study_id>') |
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.
I think this should just be study
?
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.
i dont know the usecase for having 'study' information in _links but, it is easier to get all the study_files from study as each study_file belong to one study. i am saying this because we can remove this line altogether from _links similar to what we did for investigator and study resources.
|
||
|
||
class StudyFileTest(FlaskTestCase): | ||
''' |
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.
Small nit, but we should stay consistent with the use of double quotes for docstrings.
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.
yep i used study tests as reference i am gonna change for other resources as well👍
_links = ma.Hyperlinks({ | ||
'self': ma.URLFor(Meta.resource_url, kf_id='<kf_id>'), | ||
'collection': ma.URLFor(Meta.collection_url), | ||
'study_files': ma.URLFor('api.studies', kf_id='<study_id>') |
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.
Should be singular:
'study_file': ma.URLFor('api.studies', kf_id='<study_id>')
self.assertEqual(study_file['kf_id'], kf_id) | ||
self.assertEqual(study_file['file_name'], body['file_name']) | ||
|
||
def test_patch_study_file_no_required_field(self): |
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.
Could probably remove this test since it's essentially the same as test_patch
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.
👍
tests/test_pagination.py
Outdated
@@ -31,6 +32,12 @@ def participants(client): | |||
db.session.add(s) | |||
db.session.commit() | |||
|
|||
# Add study files for studies | |||
for _ in range(102): |
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.
Could probably create the study files and link the files to a study in the loop where you're creating each study
c92b896
to
a214931
Compare
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.
💯
a214931
to
e6c6f24
Compare
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.
👍
e6c6f24
to
ffcfca5
Compare
Added resources for study_file endpoint
Added tests for study_file endpoint
Resolves #197