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