当前位置: 首页>>代码示例>>Python>>正文


Python HttpRequest.FILES['refGenomeFile']方法代码示例

本文整理汇总了Python中django.http.request.HttpRequest.FILES['refGenomeFile']方法的典型用法代码示例。如果您正苦于以下问题:Python HttpRequest.FILES['refGenomeFile']方法的具体用法?Python HttpRequest.FILES['refGenomeFile']怎么用?Python HttpRequest.FILES['refGenomeFile']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.http.request.HttpRequest的用法示例。


在下文中一共展示了HttpRequest.FILES['refGenomeFile']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_upload_long_id_genbank

# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import FILES['refGenomeFile'] [as 别名]
    def test_upload_long_id_genbank(self):
        project = self.common_entities['project']
        ref_genome_label = 'dirty_upload'
        request = HttpRequest()
        request.POST = {
            'projectUid': project.uid,
            'refGenomeLabel': ref_genome_label,
            'importFileFormat': 'genbank'
        }
        request.method = 'POST'
        request.user = self.common_entities['user']
        authenticate(username=TEST_USERNAME, password=TEST_PASSWORD)
        self.assertTrue(request.user.is_authenticated())

        request.FILES['refGenomeFile'] = UploadedFile(
                file=open(LONG_ID_GENBANK),
                name='dirty_genbank.gb')

        response = create_ref_genome_from_browser_upload(request)
        self.assertEqual(STATUS_CODE__SUCCESS, response.status_code)
        self.assertFalse(json.loads(response.content).get('error', False))
开发者ID:woodymit,项目名称:millstone,代码行数:23,代码来源:test_xhr_handlers.py

示例2: test_run_alignment_with_spaces_in_genbank_filename

# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import FILES['refGenomeFile'] [as 别名]
    def test_run_alignment_with_spaces_in_genbank_filename(self):
        project = self.common_entities['project']
        ref_genome_label = 'dirty_upload'
        request = HttpRequest()
        request.POST = {
            'projectUid': project.uid,
            'refGenomeLabel': ref_genome_label,
            'importFileFormat': 'genbank'
        }
        request.method = 'POST'
        request.user = self.common_entities['user']
        authenticate(username=TEST_USERNAME, password=TEST_PASSWORD)
        self.assertTrue(request.user.is_authenticated())

        request.FILES['refGenomeFile'] = UploadedFile(
                file=open(TEST_GENBANK),
                name='dirty_genbank (spaces).gb')

        response = create_ref_genome_from_browser_upload(request)
        self.assertEqual(STATUS_CODE__SUCCESS, response.status_code)
        self.assertFalse(json.loads(response.content).get('error', False))

        # Get reference genome
        ref_genome = ReferenceGenome.objects.get(
                project=project,
                label=ref_genome_label)

        # Create sample model
        sample = ExperimentSample.objects.create(
                project=project,
                label='test_sample')

        # Add fastq datasets to sample
        add_dataset_to_entity(
                sample,
                Dataset.TYPE.FASTQ1,
                Dataset.TYPE.FASTQ1,
                filesystem_location=TEST_DIRTY_FQ_1)

        # Add fastq datasets to sample
        add_dataset_to_entity(
                sample,
                Dataset.TYPE.FASTQ2,
                Dataset.TYPE.FASTQ2,
                filesystem_location=TEST_DIRTY_FQ_2)

        # Run alignment of sample to reference
        alignment_group_label = 'test_alignment'
        sample_list = [sample]

        result = run_pipeline(
                alignment_group_label, ref_genome, sample_list)

        alignment_group = result[0]
        alignment_async_result = result[1]
        variant_calling_async_result = result[2]
        alignment_async_result.get()
        variant_calling_async_result.get()
        alignment_group = AlignmentGroup.objects.get(uid=alignment_group.uid)
        self.assertEqual(AlignmentGroup.STATUS.COMPLETED,
                alignment_group.status)
开发者ID:woodymit,项目名称:millstone,代码行数:63,代码来源:test_xhr_handlers.py


注:本文中的django.http.request.HttpRequest.FILES['refGenomeFile']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。