-
Notifications
You must be signed in to change notification settings - Fork 79
download public prep data #3491
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -535,6 +535,26 @@ def test_download(self): | |
| 'mapping_files/5_mapping_file.txt') | ||
| self.assertRegex(response.body.decode('ascii'), exp) | ||
|
|
||
| # Now let's check download prep with no raw data access | ||
| response = self.get('/public_download/?data=raw&prep_id=1') | ||
| self.assertTrue(response.reason.startswith('No raw data access.')) | ||
|
|
||
| # Now success | ||
| Study(1).public_raw_download = True | ||
| response = self.get('/public_download/?data=raw&prep_id=1') | ||
| self.assertEqual(response.code, 200) | ||
| exp = ('- [0-9]* /protected/raw_data/1_s_G1_L001_sequences.fastq.gz ' | ||
| 'raw_data/1_s_G1_L001_sequences.fastq.gz\n- [0-9]* /protected' | ||
| '/raw_data/1_s_G1_L001_sequences_barcodes.fastq.gz raw_data/' | ||
| '1_s_G1_L001_sequences_barcodes.fastq.gz\n- [0-9]* /protected/' | ||
| 'templates/1_prep_1_qiime_19700101-000000.txt mapping_files/' | ||
| '1_mapping_file.txt\n') | ||
| self.assertRegex(response.body.decode('ascii'), exp) | ||
|
|
||
| # for simplicity, let's just check respose.code | ||
| response = self.get('/public_download/?data=biom&prep_id=1') | ||
| self.assertEqual(response.code, 200) | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| def test_download_sample_information(self): | ||
| response = self.get('/public_artifact_download/') | ||
| self.assertEqual(response.code, 422) | ||
|
|
||
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.
This is getting to be a lot of nested else. I'm sure the logic works but it makes it quite hard to read.
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 agree with you, I think this
classshows 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.