本文整理汇总了Python中osc2.remote.Request.find方法的典型用法代码示例。如果您正苦于以下问题:Python Request.find方法的具体用法?Python Request.find怎么用?Python Request.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osc2.remote.Request
的用法示例。
在下文中一共展示了Request.find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_request18
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request18(self):
"""test request diff (returned object should have a write_to method"""
req = Request.find('120703')
f = req.diff()
sio = StringIO()
f.write_to(sio)
self.assertEqual(sio.getvalue(), 'some diff content\n')
示例2: test_request3
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request3(self):
"""test request validation (incoming + outgoing)"""
Request.SCHEMA = self.fixture_file('request_simple.xsd')
req = Request.find('456')
req = Request()
req.add_action(type='submit')
req.store()
示例3: test_request1
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request1(self):
"""get a request"""
req = Request.find('123')
self.assertTrue(len(req.action[:]) == 2)
self.assertEqual(req.action[0].get('type'), 'submit')
self.assertEqual(req.action[0].source.get('package'), 'abc')
self.assertEqual(req.action[0].source.get('project'), 'xyz')
self.assertEqual(req.action[0].options.sourceupdate, 'cleanup')
self.assertEqual(req.action[0].options.updatelink, '1')
self.assertEqual(req.action[1].get('type'), 'add_role')
self.assertEqual(req.action[1].target.get('project'), 'home:foo')
self.assertEqual(req.action[1].person.get('name'), 'bar')
self.assertEqual(req.action[1].person.get('role'), 'maintainer')
self.assertEqual(req.action[1].group.get('name'), 'groupxyz')
self.assertEqual(req.action[1].group.get('role'), 'reader')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(req.state.get('when'), '2010-12-27T01:36:29')
self.assertEqual(req.state.get('who'), 'abc')
self.assertEqual(req.review.get('by_group'), 'group1')
self.assertEqual(req.review.get('state'), 'new')
self.assertEqual(req.review.get('when'), '2010-12-28T00:11:22')
self.assertEqual(req.review.get('who'), 'abc')
self.assertTrue(len(req.history[:]) == 1)
self.assertEqual(req.review.comment, 'review start')
self.assertEqual(req.history[0].get('name'), 'new')
self.assertEqual(req.history[0].get('when'), '2010-12-11T00:00:00')
self.assertEqual(req.history[0].get('who'), 'creator')
示例4: test_request11
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request11(self):
"""test decline request"""
req = Request.find('73270')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'new')
# decline request
req.decline(comment='does not build')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'declined')
self.assertEqual(req.state.comment, 'does not build')
示例5: test_request10
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request10(self):
"""test revoke request"""
req = Request.find('73270')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'new')
# revoke request
req.revoke(comment='needs some more work')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'revoked')
self.assertEqual(req.state.comment, 'needs some more work')
示例6: test_request9
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request9(self):
"""test accept request"""
req = Request.find('73270')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'new')
# accept request
req.accept(comment='thanks')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'accepted')
self.assertEqual(req.state.comment, 'thanks')
示例7: show
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def show(cls, renderer, reqid, info):
"""Shows the request specified by reqid."""
global SHOW_TEMPLATE
request = Request.find(reqid)
if info.interactive:
cls.shell(renderer, info.shell_cls, [request], info)
return
renderer.render(SHOW_TEMPLATE, request=request)
if info.diff:
cls.diff(request)
示例8: change_request_state
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def change_request_state(cls, renderer, reqid, method, message, info,
supersede_id=None):
"""Changes the state of the request id reqid.
method is the method which is called on the
retrieved request object.
If message is None $EDITOR is opened.
"""
request = Request.find(reqid)
cls._change_request_state(renderer, request, method, message, info,
supersede_id)
示例9: test_request12
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request12(self):
"""test supersede request"""
req = Request.find('73270')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'new')
self.assertTrue(req.state.get('superseded_by') is None)
# supersed request
req.supersede('59130', comment='already accepted')
self.assertEqual(req.get('id'), '73270')
self.assertEqual(req.state.get('name'), 'superseded')
# XXX: or should this be a reference to the request object?
self.assertEqual(req.state.get('superseded_by'), '59130')
self.assertEqual(req.state.comment, 'already accepted')
示例10: add
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def add(cls, renderer, reqid, message, info):
"""Adds a new review to a request."""
request = Request.find(reqid)
if message is None:
message = edit_message()
kwargs = {'comment': message, 'by_user': info.user,
'by_group': info.group}
if info.package:
kwargs['by_project'] = info.package[0].project
kwargs['by_package'] = info.package[0].package
elif info.project is not None:
kwargs['by_project'] = info.project
request.add_review(**kwargs)
renderer.render(SHOW_TEMPLATE, request=request)
示例11: change_review_state
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def change_review_state(cls, renderer, reqid, method, message, info,
supersede_id=None):
"""Changes the state of a review.
method is the method which is called on the
retrieved request object.
If message is None $EDITOR is opened.
"""
request = Request.find(reqid)
reviews = cls._find_reviews(request, info)
if reviews:
# take the first review
cls._change_review_state(renderer, request, reviews[0], method,
message, info, supersede_id)
示例12: test_request13
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request13(self):
"""test accept review"""
req = Request.find('120704')
self.assertEqual(req.get('id'), '120704')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(len(req.review[:]), 3)
review = req.review[2]
self.assertTrue(review.get('state'), 'new')
self.assertTrue(review.get('by_group'), 'autobuild-team')
# accept review
req.accept(comment='Thanks', review=review)
self.assertEqual(req.get('id'), '120704')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(len(req.review[:]), 3)
self.assertEqual(req.review[2].get('state'), 'accepted')
self.assertEqual(req.review[2].comment, 'Thanks')
示例13: test_request15
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request15(self):
"""test supersede review"""
req = Request.find('120704')
self.assertEqual(req.get('id'), '120704')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(len(req.review[:]), 3)
review = req.review[2]
self.assertTrue(review.get('state'), 'new')
self.assertTrue(review.get('by_group'), 'autobuild-team')
# supersede review
req.supersede('12345', comment='see rq12345', review=review)
self.assertEqual(req.get('id'), '120704')
self.assertEqual(req.state.get('name'), 'superseded')
self.assertEqual(len(req.review[:]), 3)
self.assertEqual(req.review[2].get('state'), 'superseded')
self.assertEqual(req.review[2].comment, 'see rq12345')
示例14: test_request14
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request14(self):
"""test decline review"""
req = Request.find('120704')
self.assertEqual(req.get('id'), '120704')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(len(req.review[:]), 3)
review = req.review[2]
self.assertTrue(review.get('state'), 'new')
self.assertTrue(review.get('by_group'), 'autobuild-team')
# decline review
req.decline(comment='does not look good', review=review)
self.assertEqual(req.get('id'), '120704')
self.assertEqual(req.state.get('name'), 'declined')
self.assertEqual(len(req.review[:]), 3)
self.assertEqual(req.review[2].get('state'), 'declined')
self.assertEqual(req.review[2].comment, 'does not look good')
示例15: test_request16
# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import find [as 别名]
def test_request16(self):
"""test accept review (by_project and by_package)"""
req = Request.find('120703')
self.assertEqual(req.get('id'), '120703')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(len(req.review[:]), 3)
review = req.review[2]
self.assertTrue(review.get('state'), 'new')
self.assertTrue(review.get('by_project'), 'project')
self.assertTrue(review.get('by_package'), 'package')
# accept review
req.accept(comment='Thanks', review=review)
self.assertEqual(req.get('id'), '120703')
self.assertEqual(req.state.get('name'), 'review')
self.assertEqual(len(req.review[:]), 3)
self.assertEqual(req.review[2].get('state'), 'accepted')
self.assertEqual(req.review[2].comment, 'Thanks')