Skip to content

Conversation

@antgonza
Copy link
Member

By mistake this is not currently allowed, and it should be.

@coveralls
Copy link

coveralls commented Nov 20, 2025

Coverage Status

coverage: 92.151% (-0.001%) from 92.152%
when pulling 97e96cc on antgonza:download-public-prep-data
into ab4644c on qiita-spots:dev.

Copy link
Collaborator

@lucaspatel lucaspatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggested improvements but otherwise fine.

raise HTTPError(422, reason='No raw data access. If this '
'is a mistake contact: %s'
% qiita_config.help_email)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting to be a lot of nested else. I'm sure the logic works but it makes it quite hard to read.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you, I think this class shows how it has grown over time, which makes it difficult and complex. Thus, decided to rewrite it. Note that I didn't change the tests as those are checking multiple options, parameters and errors.

to_download.extend(self._list_artifact_files_nginx(a))

if not to_download:
raise HTTPError(422, reason='Nothing to download. If '
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is your linter splitting the line up or something, but this seems unnecessary.

# for simplicity, let's just check respose.code
response = self.get('/public_download/?data=biom&prep_id=1')
self.assertEqual(response.code, 200)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to test or communicate intended behavior for the conditions you added in the main logic, namely:
if a.visibility != 'public' or a.has_human:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what if there are no artifacts available? 422 with "Nothing to download" is that somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely agree, note that those tests are done for when a user uses study_id vs. prep_id. Thus, in stead of creating more tests, I "simplified" the code and added a lot of comments so a study_id test also covers the prep_id test, and viceversa - as they now share the same/main error checking blocks.

Copy link
Collaborator

@lucaspatel lucaspatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much improved, nice work

@lucaspatel lucaspatel merged commit ec231d5 into qiita-spots:dev Nov 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants