def test_generate_none(self): g = BuildRequestGenerator(builders=['not_existing_builder']) buildrequest = yield self.insert_buildrequest_new() report = yield g.generate(self.master, None, ('buildrequests', 11, 'new'), buildrequest) self.assertIsNone(report, None)
def setup_generator(self, message=None, **kwargs): if message is None: message = { "body": "start body", "type": "plain", "subject": "start subject" } g = BuildRequestGenerator(**kwargs) g.formatter = Mock(spec=g.formatter) g.formatter.format_message_for_build.return_value = message return g
def _create_default_generators(self): start_formatter = MessageFormatterRenderable('Build started.') end_formatter = MessageFormatterRenderable('Build done.') pending_formatter = MessageFormatterRenderable('Build pending.') return [ BuildRequestGenerator(formatter=pending_formatter), BuildStartEndStatusGenerator(start_formatter=start_formatter, end_formatter=end_formatter) ]
def test_list_params_check_raises(self, arg_name, arg_value): kwargs = {arg_name: arg_value} g = BuildRequestGenerator(**kwargs) with self.assertRaisesConfigError('must be a list or None'): g.check()