當前位置: 首頁>>代碼示例>>Python>>正文


Python Job.key方法代碼示例

本文整理匯總了Python中jobs.models.Job.key方法的典型用法代碼示例。如果您正苦於以下問題:Python Job.key方法的具體用法?Python Job.key怎麽用?Python Job.key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jobs.models.Job的用法示例。


在下文中一共展示了Job.key方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_only_admin_can_access

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import key [as 別名]
 def test_only_admin_can_access(self):
     self.client.logout()
     assert self.client.login(email="[email protected]", roles=[roles.DJ])
     r = self.client.post(reverse("jobs.start"), data={"job_name": "build-trafficlog-report"})
     eq_(r.status_code, 403)
     job = Job(job_name="build-trafficlog-report")
     job.put()
     r = self.client.post(reverse("jobs.work"), data={"job_key": job.key(), "params": "{}"})
     eq_(r.status_code, 403)
     r = self.client.post(reverse("jobs.product", args=[str(job.key())]))
     eq_(r.status_code, 403)
開發者ID:chirpradio,項目名稱:chirpradio,代碼行數:13,代碼來源:tests.py

示例2: test_only_admin_can_access

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import key [as 別名]
 def test_only_admin_can_access(self):
     self.client.logout()
     assert self.client.login(email="[email protected]",
                              roles=[roles.DJ])
     r = self.client.post(reverse('jobs.start'),
                          data={'job_name': 'build-trafficlog-report'})
     eq_(r.status_code, 403)
     job = Job(job_name='build-trafficlog-report')
     job.put()
     r = self.client.post(reverse('jobs.work'),
                          data={'job_key': job.key(),
                                'params': '{}'})
     eq_(r.status_code, 403)
     r = self.client.post(reverse('jobs.product', args=[str(job.key())]))
     eq_(r.status_code, 403)
開發者ID:BubbleTouchSoftware,項目名稱:chirpradio,代碼行數:17,代碼來源:tests.py

示例3: test_work

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import key [as 別名]
 def test_work(self):
     job = Job(job_name='some-job')
     job.put()
     response = self.client.post(reverse('jobs.work'), {
         'job_key': str(job.key()),
         'params': '{}'
     })
     self.assertEqual(response.status_code, 403)
開發者ID:BubbleTouchSoftware,項目名稱:chirpradio,代碼行數:10,代碼來源:tests.py

示例4: test_get_nonexistant_job_product

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import key [as 別名]
 def test_get_nonexistant_job_product(self):
     # make a deleted job:
     job = Job(job_name="counter")
     job.save()
     job_key = job.key()
     job.delete()
     
     response = self.client.get(reverse('jobs.product', args=(job_key,)))
     self.assertEqual(response.status_code, 404)
開發者ID:BubbleTouchSoftware,項目名稱:chirpradio,代碼行數:11,代碼來源:tests.py

示例5: test_job_reaper_kills_old_jobs

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import key [as 別名]
 def test_job_reaper_kills_old_jobs(self):
     # make an old job:
     job = Job(job_name='counter')
     job.started = datetime.datetime.now() - timedelta(days=3)
     job.save()
     old_job_key = job.key()
     
     response = self.client.post(reverse('jobs.start'), {
         'job_name': 'counter'
     })
     json_response = simplejson.loads(response.content)
     self.assert_json_success(json_response)
     
     self.assertEqual(Job.get(old_job_key), None)
開發者ID:BubbleTouchSoftware,項目名稱:chirpradio,代碼行數:16,代碼來源:tests.py

示例6: test_product

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import key [as 別名]
 def test_product(self):
     job = Job(job_name='some-job')
     job.put()
     response = self.client.get(reverse('jobs.product',
                                args=[str(job.key())]))
     self.assertEqual(response.status_code, 403)
開發者ID:BubbleTouchSoftware,項目名稱:chirpradio,代碼行數:8,代碼來源:tests.py


注:本文中的jobs.models.Job.key方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。