本文整理汇总了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')
示例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')
示例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)
示例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
示例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
示例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'})
示例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')
示例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])