Пример #1
0
 def test_verify_manual_jobs_have_parsable_description(self):
     for message in self.messages:
         if message['plugin'] in ('user-verify', 'user-interact', 'manual'):
             for key in ['description', 'description_extended']:
                 if key in message and message[key]:
                     descstream = StringIO(message[key])
                     parser = DescriptionParser(descstream)
                     result = DescriptionResult()
                     parser.run(result)
                     msg = "Description for manual job {} has wrong format"
                     self.assertTrue(result.fields,
                                     msg.format(message['name']))
Пример #2
0
 def test_verify_manual_jobs_have_parsable_description(self):
     for message in self.messages:
         if message['plugin'] in ('user-verify', 'user-interact', 'manual'):
             for key in ['description', 'description_extended']:
                 if key in message and message[key]:
                     descstream = StringIO(message[key])
                     parser = DescriptionParser(descstream)
                     result = DescriptionResult()
                     parser.run(result)
                     msg = "Description for manual job {} has wrong format"
                     self.assertTrue(result.fields,
                                     msg.format(message['name']))
Пример #3
0
    def message_file(self, file, filename="<stream>"):
        template = TemplateI18n()
        messages = template.load_file(file, filename)
        for message in messages:
            long_ext = "_extended"
            for long_key in list(message.keys()):
                if long_key.endswith(long_ext):
                    short_key = long_key.replace(long_ext, "")
                    message[short_key] = message.pop(long_key)
            if "description" in message:
                parser = DescriptionParser(StringIO(message["description"]))
                result = DescriptionResult(message)
                parser.run(result)

        if messages:
            self._manager.reactor.fire("report-messages", messages)
Пример #4
0
    def message_file(self, file, filename="<stream>"):
        template = TemplateI18n()
        messages = template.load_file(file, filename)
        for message in messages:
            long_ext = "_extended"
            for long_key in list(message.keys()):
                if long_key.endswith(long_ext):
                    short_key = long_key.replace(long_ext, "")
                    message[short_key] = message.pop(long_key)
            if "description" in message:
                parser = DescriptionParser(StringIO(message["description"]))
                result = DescriptionResult(message)
                parser.run(result)

        if messages:
            self._manager.reactor.fire("report-messages", messages)
Пример #5
0
 def getParser(self, string):
     stream = StringIO(string)
     return DescriptionParser(stream)