def test_make_dummy_fail_receipt(self): '''test _make_dummy_fail_receipt''' tmp_receipt = 'tmp.ena.submit_files.make_dummy_fail_receipt.xml' submit_files._make_dummy_fail_receipt(tmp_receipt) receipt = submission_receipt.SubmissionReceipt(tmp_receipt) self.assertFalse(receipt.successful) os.unlink(tmp_receipt)
def test_make_dummy_success_receipt(self): '''test _make_dummy_success_receipt''' tmp_receipt = 'tmp.ena.submit_files.make_dummy_success_receipt.xml' submit_files._make_dummy_success_receipt(tmp_receipt, 'project') receipt = submission_receipt.SubmissionReceipt(tmp_receipt) self.assertTrue(receipt.successful) os.unlink(tmp_receipt)
def test_init_success_receipt(self): '''test __init__ with successful receipt''' receipt_xml = os.path.join(data_dir, 'init.good_receipt.xml') receipt = submission_receipt.SubmissionReceipt(receipt_xml) self.assertTrue(receipt.successful) expected_accessions = { 'SAMPLE': 'ERS1234567', 'SUBMISSION': 'ERA1234567', } self.assertEqual(expected_accessions, receipt.accessions)
def run(self): original_dir = os.getcwd() os.chdir(self.object_xml_dir) self._make_xml_files() files = { 'SUBMISSION': self.submission_xml, self.object_type.upper(): self.object_xml } submit_files.submit_xml_files(self.ini_file, self.receipt_xml, files=files, use_test_server=self.use_test_server, unit_test=self.unit_test, unit_test_obj_type=self.object_type) self.submission_receipt = submission_receipt.SubmissionReceipt( self.receipt_xml) os.chdir(original_dir)
def test_init_fail_receipt(self): '''test __init__ with failed receipt''' receipt_xml = os.path.join(data_dir, 'init.bad_receipt.xml') receipt = submission_receipt.SubmissionReceipt(receipt_xml) self.assertFalse(receipt.successful) self.assertEqual({}, receipt.accessions)