示例#1
0
 def test_parse_submit_succeeds_if_second_input_blob_missing_for_bam(self):
     argv = create_valid_args_output_for_submission()
     i, j = argv.index("--input-blob-name-1"), argv.index("--input-blob-name-2")
     argv[i+1] = "i.bam"
     argv = argv[:j] + argv[j+2:]
     result = malibuargs.parse(argv, None, None, None, None, None)
     self.assertIsNotNone(result)
示例#2
0
 def test_parse_empty_bools_keeps_defaults(self):
     argv = "cancel -u https://url -k key -w 123".split()
     args = malibuargs.parse(argv + ["-pl", ""], None, None, None, None, None)
     args_output = malibuargs.ArgsOutput()
     args_output.fill(args)
     self.assertEquals(args_output.command, "CANCEL")
     self.assertEquals(args_output.api_url_base, "https://url")
     self.assertEquals(args_output.access_key, "key")
     self.assertEquals(args_output.workflow_id, "123")
     self.assertEquals(args_output.poll, False)
示例#3
0
 def test_parse_runs_successfully_with_unmatching_fastq_names(self):
     argv = "submit -f tests/unittestconfig.txt".split()
     using_key = False
     with open("tests/unittestconfig.txt", 'r') as file:
         for line in file:
             if "input_storage_account_key" in line.lower():
                 using_key = True
                 break
     if using_key:
         args = malibuargs.parse(argv + ["-b2", "file1.fq"], None, None,
                                 None, None, None)
         blobs1 = args.input_blob_name_1
         blobs2 = args.input_blob_name_2
         blobs1_parsed = []
         blobs2_parsed = []
         for blob in blobs1:
             if "?" in blob:
                 blob = blob.split("?")[0]
             blobs1_parsed.append(blob)
         for blob in blobs2:
             if "?" in blob:
                 blob = blob.split("?")[0]
             blobs2_parsed.append(blob)
         self.assertListEqual(blobs1_parsed, ["chr21-10k_1.fq.gz"])
         self.assertListEqual(blobs2_parsed, ["file1.fq"])
     else:
         args = malibuargs.parse(argv + ["-b2", "file1.fq?sas"], None, None,
                                 None, None, None)
         blobs1 = args.input_blob_name_1
         blobs2 = args.input_blob_name_2
         blobs1_parsed = []
         blobs2_parsed = []
         for blob in blobs1:
             if "?" in blob:
                 blob = blob.split("?")[0]
             blobs1_parsed.append(blob)
         for blob in blobs2:
             if "?" in blob:
                 blob = blob.split("?")[0]
             blobs2_parsed.append(blob)
         self.assertListEqual(blobs1_parsed, ["chr21-10k_1.fq.gz"])
         self.assertListEqual(blobs2_parsed, ["file1.fq"])
示例#4
0
 def test_parse_submit_fails_if_one_io_arg_missing(self):
     argv = create_valid_args_output_for_submission()
     missing = [
         "--process-args", "--input-storage-account-container",
         "--input-storage-account-key", "--input-storage-account-name",
         "--output-storage-account-container",
         "--output-storage-account-key", "--output-storage-account-name"
     ]
     for arg in missing:
         i = argv.index(arg)
         argv[i + 1] = ""
         with self.assertRaises(SystemExit):
             result = malibuargs.parse(argv, None, None, None, None, None)
示例#5
0
 def test_parse_runs_successfully_with_uneven_bam(self):
     argv = "submit -f tests/unittestconfig.txt".split()
     using_key = False
     with open("tests/unittestconfig.txt", 'r') as file:
         for line in file:
             if "input_storage_account_key" in line.lower():
                 using_key = True
                 break
     if using_key:
         args = malibuargs.parse(
             argv + ["-b2", "file1.bam", "-b1", "file1.sam", "file2.sam"],
             None, None, None, None, None)
         self.assertListEqual(args.input_blob_name_1,
                              ["file1.sam", "file2.sam"])
         self.assertListEqual(args.input_blob_name_2, ["file1.bam"])
     else:
         args = malibuargs.parse(
             argv + [
                 "-b2", "file1.bam?sas", "-b1", "file1.sam?sas",
                 "file2.sam?sas"
             ], None, None, None, None, None)
         self.assertListEqual(args.input_blob_name_1,
                              ["file1.sam?sas", "file2.sam?sas"])
         self.assertListEqual(args.input_blob_name_2, ["file1.bam?sas"])
示例#6
0
 def test_parse_runs_successfully_with_options_from_config(self):
     argv = "status -f tests/unittestconfig.txt -w 123".split()
     args = malibuargs.parse(argv, None, None, None, None, None)
     self.assertEquals(args.command, "status")
     self.assertEquals(args.workflow_id, "123")
示例#7
0
 def test_parse_submit_arguments_on_full_set(self):
     argv = create_valid_args_output_for_submission()
     result = malibuargs.parse(argv, None, None, None, None, None)
     self.assertIsNotNone(result)
示例#8
0
 def test_parse_skips_missing_config(self):
     argv = "list -u https://url -k key -f imaginary.config".split()
     args = malibuargs.parse(argv, None, None, None, None, None)
     self.assertEquals(args.command, "list")
     self.assertEquals(args.api_url_base, "https://url")
     self.assertEquals(args.access_key, "key")
示例#9
0
 def test_parse_fails_with_uneven_fastq(self):
     argv = "submit -f tests/unittestconfig.txt".split()
     with self.assertRaises(SystemExit):
         args = malibuargs.parse(argv + ["-b2", ""], None, None, None, None,
                                 None)
示例#10
0
 def test_parse_fails_without_inputs(self):
     argv = "submit -f tests/unittestconfig.txt".split()
     with self.assertRaises(SystemExit):
         malibuargs.parse(argv + ["-b1", "", "-b2", ""], None, None, None, None, None)
示例#11
0
 def test_parse_submit_succeeds_if_bz_valid(self):
     argv = create_valid_args_output_for_submission()
     argv.extend(["--bgzip-output", "true"])
     result = malibuargs.parse(argv, None, None, None, None, None)
     self.assertIsNotNone(result)
示例#12
0
 def test_parse_submit_fails_if_bz_not_supported(self):
     argv = create_valid_args_output_for_submission()
     argv.extend(["--bgzip-output", "Invalid"])
     with self.assertRaises(SystemExit):
         malibuargs.parse(argv, None, None, None, None, None)
示例#13
0
 def test_parse_submit_succeeds_if_erc_valid(self):
     argv = create_valid_args_output_for_submission()
     argv.extend(["--emit-ref-confidence", "gvcf"])
     result = malibuargs.parse(argv, None, None, None, None, None)
     self.assertIsNotNone(result)
示例#14
0
 def test_parse_submit_fails_if_erc_not_supported(self):
     argv = create_valid_args_output_for_submission()
     argv.extend(["--emit-ref-confidence", "vcf"])
     with self.assertRaises(SystemExit):
         malibuargs.parse(argv, None, None, None, None, None)
示例#15
0
 def test_parse_submit_fails_if_both_input_blobs_missing(self):
     argv = create_valid_args_output_for_submission()
     i, j = argv.index("--input-blob-name-1"), argv.index("--input-blob-name-2")
     argv = argv[:i] + argv[j+2:]
     with self.assertRaises(SystemExit):
         malibuargs.parse(argv, None, None, None, None, None)
示例#16
0
 def test_parse_fails_without_required_options(self):
     argv = "submit -u https://url --access-key key -b1 blob1".split()
     with self.assertRaises(SystemExit):
         args = malibuargs.parse(argv, None, None, None, None, None)
示例#17
0
 def test_parse_fails_with_mixed_bam_fastq(self):
     argv = "submit -f tests/unittestconfig.txt".split()
     with self.assertRaises(SystemExit):
         args = malibuargs.parse(argv + ["-b1", "file1.bam"], None, None,
                                 None, None, None)
示例#18
0
 def test_parse_fails_when_command_missing(self):
     argv = "-f tests/unittestconfig.txt".split()
     with self.assertRaises(SystemExit):
         args = malibuargs.parse(argv, None, None, None, None, None)
示例#19
0
 def test_parse_fails_with_no_known_files(self):
     argv = "submit -f tests/unittestconfig.txt".split()
     with self.assertRaises(SystemExit):
         args = malibuargs.parse(
             argv + ["-b2", "file.txt", "-b1", "file.jpg"], None, None,
             None, None, None)
示例#20
0
 def test_parse_fails_on_wrong_command(self):
     argv = "do -f tests/unittestconfig.txt".split()
     with self.assertRaises(SystemExit):
         args = malibuargs.parse(argv, None, None, None, None, None)
示例#21
0
 def test_parse_handles_negative_range_value(self):
     argv = "list -u https://url -k key -r -5:-1".split()
     args = malibuargs.parse(argv, None, None, None, None, None)
     self.assertIsNotNone(args.in_range)
示例#22
0
def get_test_args():
    """Creates an instance of ArgsOutput for unit testing purposes  """
    args = malibuargs.parse("submit -f tests/unittestconfig.txt".split(), None, None, None, None, None)
    args_output = malibuargs.ArgsOutput()
    args_output.fill(args)
    return args_output