Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 def create(cls, renderer, submit, changedevel, role, grouprole, delete,
            info):
     """Creates a new request."""
     global SHOW_TEMPLATE
     request = Request()
     message = info.message
     if message is None:
         message = edit_message()
     cls._create_submit_actions(request, submit)
     cls._create_changedevel_actions(request, changedevel)
     cls._create_role_actions(request, role)
     cls._create_grouprole_actions(request, grouprole)
     cls._create_delete_actions(request, delete)
     request.description = message
     request.store()
     renderer.render(SHOW_TEMPLATE, request=request)
Exemplo n.º 4
0
 def create(cls, renderer, submit, changedevel, role, grouprole, delete,
            info):
     """Creates a new request."""
     global SHOW_TEMPLATE
     request = Request()
     message = info.message
     if message is None:
         message = edit_message()
     cls._create_submit_actions(request, submit)
     cls._create_changedevel_actions(request, changedevel)
     cls._create_role_actions(request, role)
     cls._create_grouprole_actions(request, grouprole)
     cls._create_delete_actions(request, delete)
     request.description = message
     request.store()
     renderer.render(SHOW_TEMPLATE, request=request)
Exemplo n.º 5
0
 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')
Exemplo n.º 6
0
 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')