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


Python Request.get方法代码示例

本文整理汇总了Python中osc2.remote.Request.get方法的典型用法代码示例。如果您正苦于以下问题:Python Request.get方法的具体用法?Python Request.get怎么用?Python Request.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osc2.remote.Request的用法示例。


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

示例1: test_request19

# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import get [as 别名]
 def test_request19(self):
     """create a request (test None attrib filter in class ElementFactory"""
     # nearly identical to test_request2 (except the None's here and there)
     req = Request()
     action = req.add_action(type='submit', xyz=None)
     action.add_source(project='foo', package='bar', rev='12345')
     action.add_target(project='foobar', package=None)
     options = action.add_options()
     options.add_sourceupdate('cleanup', attr=None)
     req.description = 'some description'
     req.store()
     self.assertEqual(req.get('id'), '42')
     self.assertTrue(len(req.action) == 1)
     self.assertEqual(req.action[0].get('type'), 'submit')
     self.assertEqual(req.action[0].source.get('project'), 'foo')
     self.assertEqual(req.action[0].source.get('package'), 'bar')
     self.assertEqual(req.action[0].source.get('rev'), '12345')
     self.assertEqual(req.action[0].target.get('project'), 'foobar')
     self.assertIsNone(req.action[0].target.get('package'))
     self.assertEqual(req.action[0].options.sourceupdate, 'cleanup')
     self.assertIsNone(req.action[0].options.sourceupdate.get('attr'))
     self.assertEqual(req.state.get('name'), 'new')
     self.assertEqual(req.state.get('who'), 'username')
     self.assertEqual(req.state.get('when'), '2011-06-10T14:33:55')
     self.assertEqual(req.description, 'some description')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:27,代码来源:test_remote.py

示例2: test_request2

# 需要导入模块: from osc2.remote import Request [as 别名]
# 或者: from osc2.remote.Request import get [as 别名]
 def test_request2(self):
     """create a request"""
     req = Request()
     action = req.add_action(type='submit')
     action.add_source(project='foo', package='bar', rev='12345')
     action.add_target(project='foobar')
     options = action.add_options()
     options.add_sourceupdate('cleanup')
     req.description = 'some description'
     req.store()
     self.assertEqual(req.get('id'), '42')
     self.assertTrue(len(req.action) == 1)
     self.assertEqual(req.action[0].get('type'), 'submit')
     self.assertEqual(req.action[0].source.get('project'), 'foo')
     self.assertEqual(req.action[0].source.get('package'), 'bar')
     self.assertEqual(req.action[0].source.get('rev'), '12345')
     self.assertEqual(req.action[0].target.get('project'), 'foobar')
     self.assertEqual(req.action[0].options.sourceupdate, 'cleanup')
     self.assertEqual(req.state.get('name'), 'new')
     self.assertEqual(req.state.get('who'), 'username')
     self.assertEqual(req.state.get('when'), '2011-06-10T14:33:55')
     self.assertEqual(req.description, 'some description')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:24,代码来源:test_remote.py


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