|
21 | 21 |
|
22 | 22 | from qiita_ware.ebi import (SampleAlreadyExistsError, NoXMLError, |
23 | 23 | EBISubmission) |
| 24 | +from qiita_ware.exceptions import EBISumbissionError |
24 | 25 | from qiita_core.qiita_settings import qiita_config |
25 | 26 |
|
26 | 27 |
|
@@ -385,6 +386,16 @@ def test_add_samples_from_templates(self): |
385 | 386 | with self.assertRaises(KeyError): |
386 | 387 | submission.samples['nothere'] |
387 | 388 |
|
| 389 | + def test_add_samples_from_templates_error(self): |
| 390 | + sample_template = StringIO(SAMPLE_TEMPLATE_ERROR) |
| 391 | + prep_template = StringIO(EXP_PREP_TEMPLATE) |
| 392 | + submission = EBISubmission('001', 'teststudy', 'test asbstract', |
| 393 | + investigation_type='Other', |
| 394 | + new_investigation_type='metagenome') |
| 395 | + self.assertRaises( |
| 396 | + EBISumbissionError, submission.add_samples_from_templates, |
| 397 | + sample_template, prep_template, self.path) |
| 398 | + |
388 | 399 | def test_add_samples_from_templates_bad_directory(self): |
389 | 400 | sample_template = StringIO(EXP_SAMPLE_TEMPLATE) |
390 | 401 | prep_template = StringIO(EXP_PREP_TEMPLATE) |
@@ -648,11 +659,30 @@ def test_generate_curl_command(self): |
648 | 659 | </design> |
649 | 660 | """ |
650 | 661 |
|
| 662 | +SAMPLE_TEMPLATE_ERROR = ( |
| 663 | + "sample_name\tcollection_timestamp\tdescription\thas_extracted_data\t" |
| 664 | + "has_physical_specimen\thost_subject_id\tlatitude\tlongitude\t" |
| 665 | + "physical_location\trequired_sample_info_status_id\tsample_type\t" |
| 666 | + "str_column\n" |
| 667 | + "sample1\t2014-05-29 12:24:51\tTest Sample 1\tTrue\tTrue\tNotIdentified\t" |
| 668 | + "42.42\t41.41\tlocation1\t1\ttype1\tValue for sample 1\n" |
| 669 | + "sample2\t2014-05-29 12:24:51\tTest Sample 2\tTrue\tTrue\tNotIdentified\t" |
| 670 | + "4.2\t1.1\tlocation1\t1\ttype1\tValue for sample 2\n" |
| 671 | + "sample3\t2014-05-29 12:24:51\tTest Sample 3\tTrue\tTrue\tNotIdentified\t" |
| 672 | + "4.8\t4.41\tlocation1\t1\ttype1\tValue for sample 3\n") |
| 673 | + |
651 | 674 | EXP_SAMPLE_TEMPLATE = ( |
652 | | - "sample_name\tcollection_timestamp\tdescription\thas_extracted_data\thas_physical_specimen\thost_subject_id\tlatitude\tlongitude\tphysical_location\trequired_sample_info_status_id\tsample_type\tstr_column\ttaxon_id\tscientific_name\n" |
653 | | - "sample1\t2014-05-29 12:24:51\tTest Sample 1\tTrue\tTrue\tNotIdentified\t42.42\t41.41\tlocation1\t1\ttype1\tValue for sample 1\t9606\thomo sapiens\n" |
654 | | - "sample2\t2014-05-29 12:24:51\tTest Sample 2\tTrue\tTrue\tNotIdentified\t4.2\t1.1\tlocation1\t1\ttype1\tValue for sample 2\t9606\thomo sapiens\n" |
655 | | - "sample3\t2014-05-29 12:24:51\tTest Sample 3\tTrue\tTrue\tNotIdentified\t4.8\t4.41\tlocation1\t1\ttype1\tValue for sample 3\t9606\thomo sapiens\n") |
| 675 | + "sample_name\tcollection_timestamp\tdescription\thas_extracted_data\t" |
| 676 | + "has_physical_specimen\thost_subject_id\tlatitude\tlongitude\t" |
| 677 | + "physical_location\trequired_sample_info_status_id\tsample_type\t" |
| 678 | + "str_column\ttaxon_id\tscientific_name\n" |
| 679 | + "sample1\t2014-05-29 12:24:51\tTest Sample 1\tTrue\tTrue\tNotIdentified\t" |
| 680 | + "42.42\t41.41\tlocation1\t1\ttype1\tValue for sample 1\t9606\t" |
| 681 | + "homo sapiens\n" |
| 682 | + "sample2\t2014-05-29 12:24:51\tTest Sample 2\tTrue\tTrue\tNotIdentified\t" |
| 683 | + "4.2\t1.1\tlocation1\t1\ttype1\tValue for sample 2\t9606\thomo sapiens\n" |
| 684 | + "sample3\t2014-05-29 12:24:51\tTest Sample 3\tTrue\tTrue\tNotIdentified\t" |
| 685 | + "4.8\t4.41\tlocation1\t1\ttype1\tValue for sample 3\t9606\thomo sapiens\n") |
656 | 686 |
|
657 | 687 | EXP_PREP_TEMPLATE = ( |
658 | 688 | "sample_name\tcenter_name\tcenter_project_name\tdata_type_id\t" |
|
0 commit comments