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


Python SubmissionDetails.as_view方法代码示例

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


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

示例1: test_rejection_without_input_data

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_rejection_without_input_data(self):
     del(self.data['input_data'])
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:9,代码来源:test_api_requests.py

示例2: test_submission_makes_single_batch_entry

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submission_makes_single_batch_entry(self, m):
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
     self.assertEqual(len(Batch.objects.all()), 1)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:9,代码来源:test_api_requests.py

示例3: test_valid_submission_gets_medium_priority

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_valid_submission_gets_medium_priority(self, m):
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     subs = Submission.objects.get()
     self.assertEqual(subs.priority, Submission.MEDIUM)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:9,代码来源:test_api_requests.py

示例4: test_rejection_with_blank_submission_name

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_rejection_with_blank_submission_name(self):
     self.data['submission_name'] = ""
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:9,代码来源:test_api_requests.py

示例5: test_multiple_submission_makes_seperate_batch_entries

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_multiple_submission_makes_seperate_batch_entries(self, m):
     self.data['job'] = 'job1'
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.data['job'] = 'job2'
     self.data['input_data'] = SimpleUploadedFile('file1.txt',
                                                  bytes('these are the '
                                                        'file contents!',
                                                        'utf-8'))
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     batch_entries = Batch.objects.all()
     self.assertEqual(len(batch_entries), 2)
     self.assertNotEqual(batch_entries[0].UUID, batch_entries[1].UUID)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:20,代码来源:test_api_requests.py

示例6: test_submission_ignores_undefined_params

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submission_ignores_undefined_params(self, m):
     p1 = ParameterFactory.create(task=self.t, rest_alias="this")
     self.data['task1_strange'] = "Value2"
     self.data['task1_this'] = "Value1"
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:11,代码来源:test_api_requests.py

示例7: test_submissions_after_hard_limit_get_rejection

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submissions_after_hard_limit_get_rejection(self, m):
     for i in range(0, settings.QUEUE_HARD_LIMIT):
         s = SubmissionFactory.create(ip="127.0.0.1", status=0)
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code,
                      status.HTTP_429_TOO_MANY_REQUESTS)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:11,代码来源:test_api_requests.py

示例8: test_submission_accepts_when_all_params_given

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submission_accepts_when_all_params_given(self, m):
     p1 = ParameterFactory.create(task=self.t, rest_alias="this")
     p2 = ParameterFactory.create(task=self.t, rest_alias="that")
     self.data['task1_this'] = "Value1"
     self.data['task1_that'] = "Value2"
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:12,代码来源:test_api_requests.py

示例9: test_submission_rejects_when_a_param_is_missed

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submission_rejects_when_a_param_is_missed(self, m):
     p1 = ParameterFactory.create(task=self.t, rest_alias="this")
     p2 = ParameterFactory.create(task=self.t, rest_alias="that")
     self.data['task1_this'] = "Value1"
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
     self.assertEqual(len(Submission.objects.all()), 0)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:12,代码来源:test_api_requests.py

示例10: test_reject_batch_with_missin_params

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_reject_batch_with_missin_params(self, m):
     self.data['job'] = 'job1,job2'
     p1 = ParameterFactory.create(task=self.t, rest_alias="this")
     p2 = ParameterFactory.create(task=self.t2, rest_alias="that")
     self.data['task1_this'] = "Value1"
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:12,代码来源:test_api_requests.py

示例11: test_reject_where_one_job_does_not_exist

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_reject_where_one_job_does_not_exist(self, m):
     self.data['job'] = 'job1,job34'
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
     batch_entries = Batch.objects.all()
     self.assertEqual(len(batch_entries), 0)
     self.assertEqual(len(Submission.objects.all()), 0)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:12,代码来源:test_api_requests.py

示例12: test_submission_checks_params_across_more_than_one_task

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submission_checks_params_across_more_than_one_task(self, m):
     p1 = ParameterFactory.create(task=self.t, rest_alias="this")
     t2 = TaskFactory.create(backend=self.b, name="task2", executable="ls")
     p2 = ParameterFactory.create(task=t2, rest_alias="this2")
     self.data['task2_this2'] = "Value2"
     self.data['task1_this'] = "Value1"
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:13,代码来源:test_api_requests.py

示例13: test_rejection_with_disabled_job

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_rejection_with_disabled_job(self):
     j3 = JobFactory.create(name="job303", runnable=False)
     b3 = BackendFactory.create(root_path="/tmp/")
     t3 = TaskFactory.create(backend=b3, name="task1",
                             executable="ls")
     s3 = StepFactory(job=j3, task=t3, ordering=0)
     self.data['job'] = 'job303'
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:14,代码来源:test_api_requests.py

示例14: test_dual_submission_makes_common_batch_entries

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_dual_submission_makes_common_batch_entries(self, m):
     self.data['job'] = 'job1,job2'
     request = self.factory.post(reverse('submission'), self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
     batch_entries = Batch.objects.all()
     submission_entries = Submission.objects.all()
     self.assertEqual(len(batch_entries), 1)
     self.assertEqual(len(submission_entries), 2)
     self.assertEqual(submission_entries[0].batch, batch_entries[0])
     self.assertEqual(submission_entries[1].batch, batch_entries[0])
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:15,代码来源:test_api_requests.py

示例15: test_submissions_after_threshold_get_low_priority

# 需要导入模块: from analytics_automated.api import SubmissionDetails [as 别名]
# 或者: from analytics_automated.api.SubmissionDetails import as_view [as 别名]
 def test_submissions_after_threshold_get_low_priority(self, m):
     for i in range(0, settings.QUEUE_HOG_SIZE):
         s = SubmissionFactory.create(ip="127.0.0.1", status=0)
     # for 'reasons' reverse does not work in this class/test?????
     # request = self.factory.post(reverse('submission'), self.data,
     #                             format='multipart')
     request = self.factory.post('/analytics_automated/submission/',
                                 self.data,
                                 format='multipart')
     view = SubmissionDetails.as_view()
     response = view(request)
     subs = Submission.objects.all()
     self.assertEqual(subs[10].priority, Submission.LOW)
开发者ID:AnalyticsAutomated,项目名称:analytics_automated,代码行数:15,代码来源:test_api_requests.py


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