本文整理汇总了Python中django.http.request.HttpRequest.FILES['vcfFile']方法的典型用法代码示例。如果您正苦于以下问题:Python HttpRequest.FILES['vcfFile']方法的具体用法?Python HttpRequest.FILES['vcfFile']怎么用?Python HttpRequest.FILES['vcfFile']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.http.request.HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.FILES['vcfFile']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_upload_file
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import FILES['vcfFile'] [as 别名]
def test_upload_file(self):
VARIANT_SET_NAME = 'newVariant'
self.assertEqual(0, VariantSet.objects.count())
refGenome = self.common_entities['reference_genome']
request = HttpRequest()
request.POST = {
'refGenomeUid': refGenome.uid,
'variantSetName': VARIANT_SET_NAME,
'createSetType': 'from-file'
}
request.method = 'POST'
request.user = self.common_entities['user']
authenticate(username=TEST_USERNAME, password=TEST_PASSWORD)
self.assertTrue(request.user.is_authenticated())
#random test file selected
variant_set_file = os.path.join(GD_ROOT, 'test_data',
'recoli_321UAG_variant_set_upload.vcf')
mock_uploaded_file = UploadedFile(
file=StringIO.StringIO(),
name=variant_set_file)
request.FILES['vcfFile'] = mock_uploaded_file
response = create_variant_set(request)
self.assertEqual(STATUS_CODE__SUCCESS, response.status_code)
variantsets = VariantSet.objects.all()
self.assertEqual(1, len(variantsets))
self.assertEqual(VARIANT_SET_NAME, VariantSet.objects.get().label)
self.assertEqual(refGenome, VariantSet.objects.get().reference_genome)