當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。