本文整理汇总了Python中pyramid.testing.DummyRequest.koji方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.koji方法的具体用法?Python DummyRequest.koji怎么用?Python DummyRequest.koji使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.testing.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.koji方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_request_untested_stable
# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import koji [as 别名]
def test_set_request_untested_stable(self):
"""
Ensure that we can't submit an update for stable if it hasn't met the
minimum testing requirements.
"""
req = DummyRequest(user=DummyUser())
req.errors = cornice.Errors()
req.koji = buildsys.get_session()
eq_(self.obj.status, UpdateStatus.pending)
try:
self.obj.set_request(self.db, UpdateRequest.stable, req.user.name)
assert False
except BodhiException, e:
pass
示例2: test_set_request_stable_after_week_in_testing
# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import koji [as 别名]
def test_set_request_stable_after_week_in_testing(self, publish):
req = DummyRequest()
req.errors = cornice.Errors()
req.koji = buildsys.get_session()
req.user = model.User(name='bob')
self.obj.status = UpdateStatus.testing
self.obj.request = None
# Pretend it's been in testing for a week
self.obj.comment(
self.db, u'This update has been pushed to testing.', author=u'bodhi')
self.obj.date_testing = self.obj.comments[-1].timestamp - timedelta(days=7)
eq_(self.obj.days_in_testing, 7)
eq_(self.obj.meets_testing_requirements, True)
self.obj.set_request(self.db, UpdateRequest.stable, req)
eq_(self.obj.request, UpdateRequest.stable)
eq_(len(req.errors), 0)
publish.assert_called_once_with(
topic='update.request.stable', msg=mock.ANY)
示例3: test_set_meets_then_met_requirements
# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import koji [as 别名]
def test_set_meets_then_met_requirements(self, publish):
req = DummyRequest()
req.errors = cornice.Errors()
req.koji = buildsys.get_session()
req.user = model.User(name='bob')
self.obj.status = UpdateStatus.testing
self.obj.request = None
# Pretend it's been in testing for a week
self.obj.comment(
self.db, u'This update has been pushed to testing.', author=u'bodhi')
self.obj.date_testing = self.obj.comments[-1].timestamp - timedelta(days=7)
eq_(self.obj.days_in_testing, 7)
eq_(self.obj.meets_testing_requirements, True)
eq_(self.obj.met_testing_requirements, False)
text = config.get('testing_approval_msg') % self.obj.days_in_testing
self.obj.comment(self.db, text, author=u'bodhi')
eq_(self.obj.meets_testing_requirements, True)
eq_(self.obj.met_testing_requirements, True)