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


Python Tasks.insert方法代碼示例

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


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

示例1: test_fail

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_fail(self):
     """Test redirect to fail badge"""
     project = factories.ProjectFactory.create()
     Tasks.insert({
         'created': datetime(2010, 10, 10),
         'status': const.STATUS_FAILED,
         'project': project.name,
     })
     self._get_and_assert(project.name, 'fail')
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:11,代碼來源:test_views.py

示例2: test_success

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_success(self):
     """Test redirect to success badge"""
     project = factories.ProjectFactory.create()
     Tasks.insert({
         'created': datetime(2010, 10, 10),
         'status': const.STATUS_SUCCESS,
         'project': project.name,
     })
     self._get_and_assert(project.name, 'success')
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:11,代碼來源:test_views.py

示例3: test_get_negative_trend

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_get_negative_trend(self):
     """Test get negative trend"""
     project = factories.ProjectFactory()
     Tasks.insert([{
         'project': project.name,
         'commit': {'branch': 'branch'},
         'success_percent': n,
         'created': num,
     } for num, n in enumerate(range(5, 1, -1))])
     project.get_trend().should.be.lower_than(0)
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:12,代碼來源:test_models.py

示例4: test_update_day_time_statistic

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_update_day_time_statistic(self):
     """Test update day time statistic"""
     project = factories.ProjectFactory()
     Tasks.insert([{
         'project': project.name,
         'success_percent': 10,
         'status': STATUS_SUCCESS,
         'created': datetime.now() + timedelta(hours=4 * part),
     } for part in range(6)])
     project.update_day_time_statistic()
     len(project.day_time_statistic).should.be.ok
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:13,代碼來源:test_models.py

示例5: test_update_week_statistic

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_update_week_statistic(self):
     """Test update week statistic"""
     project = factories.ProjectFactory()
     Tasks.insert([{
         'project': project.name,
         'success_percent': 10,
         'status': STATUS_SUCCESS,
         'created': datetime.now() + timedelta(days=day),
     } for day in range(7)])
     project.update_week_statistic()
     len(project.week_statistic).should.be.ok
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:13,代碼來源:test_models.py

示例6: test_project_branches

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_project_branches(self):
     """Test getting project branches"""
     project = factories.ProjectFactory()
     Tasks.insert([{'project': project.name, 'commit': {
         'branch': 'master',
     }}, {'project': project.name, 'commit': {
         'branch': 'develop',
     }}, {'project': project.name, 'commit': {
         'branch': 'master',
     }}, {'project': project.name, 'commit': {
         'branch': 'develop',
     }}])
     set(project.branches).should.be.equal({'master', 'develop'})
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:15,代碼來源:test_models.py

示例7: test_unknown_because_last_task_not_finished

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_unknown_because_last_task_not_finished(self):
     """Test unknown because not tasks performed"""
     project = factories.ProjectFactory.create()
     Tasks.insert([{
         'created': datetime(2010, 10, 10),
         'status': const.STATUS_SUCCESS,
         'project': project.name,
     }, {
         'created': datetime(2011, 11, 11),
         'status': const.STATUS_NEW,
         'project': project.name,
     }])
     self._get_and_assert(project.name, 'unknown')
開發者ID:coviolations,項目名稱:coviolations_web,代碼行數:15,代碼來源:test_views.py

示例8: test_attach_success_percent_only_with_dashboard_branch

# 需要導入模塊: from tasks.models import Tasks [as 別名]
# 或者: from tasks.models.Tasks import insert [as 別名]
 def test_attach_success_percent_only_with_dashboard_branch(self):
     """Test attach success percent only with dashboard branch"""
     project = factories.ProjectFactory(
         owner=self.user, dashboard_branch='branch',
     )
     Tasks.insert([{
         'project': project.name,
         'commit': {'branch': 'branch'},
         'created': datetime(2005, 5, 5),
         'success_percent': 12,
     }, {
         'project': project.name,
         'commit': {'branch': 'test'},
         'created': datetime(2006, 5, 5),
         'success_percent': 92,
     }])
     response = self.api_client.get(
         '{}{}/?with_success_percent=true'.format(self.url, project.name),
     )
     self.deserialize(response)['success_percents'].should.be.equal([12])
開發者ID:michaeljoseph,項目名稱:coviolations_web,代碼行數:22,代碼來源:test_resources.py


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