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


Python models.Tasks类代码示例

本文整理汇总了Python中tasks.models.Tasks的典型用法代码示例。如果您正苦于以下问题:Python Tasks类的具体用法?Python Tasks怎么用?Python Tasks使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_update_quality_game_with_new_violation

 def test_update_quality_game_with_new_violation(self):
     """Test update quality game with new violation"""
     project = factories.ProjectFactory()
     Tasks.save({
         'project': project.name,
         'success_percent': 10,
         'status': STATUS_SUCCESS,
         'created': datetime.now() - timedelta(hours=5),
         'commit': {
             'branch': 'test',
             'author': 'test',
             'inner': [{'author': {'url': 'test'}}]
         },
         'violations': [],
     })
     project.update_quality_game({
         'project': project.name,
         'success_percent': 15,
         'status': STATUS_SUCCESS,
         'created': datetime.now(),
         'commit': {
             'branch': 'test',
             'author': 'test',
             'inner': [{'author': {'url': 'test'}}]
         },
         'violations': [
             {'name': 'cat', 'success_percent': 15},
         ],
     })
     project.quality_game['violations']['cat']['test']['value']\
         .should.be.equal(1)
开发者ID:michaeljoseph,项目名称:coviolations_web,代码行数:31,代码来源:test_models.py

示例2: test_fail_on_travis_api_error

 def test_fail_on_travis_api_error(self):
     """Test fail on travis api error"""
     travis_ci.requests.get.side_effect = Exception
     data = self._create_task()
     with LogCapture() as log_capture:
         travis_ci.travis_ci_service(data).should.be.none
         list(log_capture.actual())[0].should.contain('ERROR')
     Tasks.find({}).count().should.be.equal(0)
开发者ID:coviolations,项目名称:coviolations_web,代码行数:8,代码来源:test_travis_ci.py

示例3: test_fail_if_already_exists

 def test_fail_if_already_exists(self):
     """Test fail if job already exists"""
     self._create_task()
     data = self._create_task()
     with LogCapture() as log_capture:
         travis_ci.travis_ci_service(data).should.be.none
         list(log_capture.actual())[0].should.contain('ERROR')
     Tasks.find({}).count().should.be.equal(1)
开发者ID:coviolations,项目名称:coviolations_web,代码行数:8,代码来源:test_travis_ci.py

示例4: test_get_badge_with_filtering

 def test_get_badge_with_filtering(self):
     """Test get badge with filtering"""
     project = factories.ProjectFactory.create()
     Tasks.save({
         'status': const.STATUS_SUCCESS,
         'project': project.name,
         'commit': {'branch': 'test'}
     })
     self._get_and_assert(project.name, 'success', '?branch=test')
开发者ID:coviolations,项目名称:coviolations_web,代码行数:9,代码来源:test_views.py

示例5: test_success

 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,代码行数:9,代码来源:test_views.py

示例6: test_get_success_percents

 def test_get_success_percents(self):
     """Test get success percents"""
     project = factories.ProjectFactory()
     Tasks.save({
         'project': project.name,
         'commit': {'branch': 'branch'},
         'success_percent': 92,
     })
     project.get_success_percents(10).should.be.equal([92])
开发者ID:coviolations,项目名称:coviolations_web,代码行数:9,代码来源:test_models.py

示例7: test_fail

 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,代码行数:9,代码来源:test_views.py

示例8: test_get_neutral_trend

 def test_get_neutral_trend(self):
     """Test get neutral trend"""
     project = factories.ProjectFactory()
     Tasks.save({
         'project': project.name,
         'commit': {'branch': 'branch'},
         'success_percent': 0,
     })
     project.get_trend().should.be.equal(0)
开发者ID:coviolations,项目名称:coviolations_web,代码行数:9,代码来源:test_models.py

示例9: test_get_negative_trend

 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,代码行数:10,代码来源:test_models.py

示例10: _create_task

 def _create_task(self):
     """Create task"""
     task_id = Tasks.save({
         'project': 'test',
         'service': {
             'name': 'travis_ci',
             'job_id': 15,
         }
     })
     return Tasks.find_one(task_id)
开发者ID:coviolations,项目名称:coviolations_web,代码行数:10,代码来源:test_travis_ci.py

示例11: test_success

 def test_success(self):
     """Test success"""
     task_id = Tasks.save({
         'project': 'test',
         'service': {
             'name': 'token',
             'token': self.project.token,
         }
     })
     data = Tasks.find_one(task_id)
     task_id.should.be.equal(token_service(data))
开发者ID:coviolations,项目名称:coviolations_web,代码行数:11,代码来源:test_token.py

示例12: test_update_week_statistic

 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,代码行数:11,代码来源:test_models.py

示例13: test_update_day_time_statistic

 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,代码行数:11,代码来源:test_models.py

示例14: test_unknown_because_last_task_not_finished

 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,代码行数:13,代码来源:test_views.py

示例15: test_fail_on_wrong_project

 def test_fail_on_wrong_project(self):
     """Test fail on wrong project"""
     travis_ci.requests.get.return_value = MagicMock(
         json=MagicMock(return_value={
             'repository_id': 2,
             'slug': 'wrong',
         })
     )
     data = self._create_task()
     with LogCapture() as log_capture:
         travis_ci.travis_ci_service(data).should.be.none
         list(log_capture.actual())[0].should.contain('ERROR')
     Tasks.find({}).count().should.be.equal(0)
开发者ID:coviolations,项目名称:coviolations_web,代码行数:13,代码来源:test_travis_ci.py


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