示例#1
0
    def test_load_default_events_file(self):
        """
        Check that the events file is valid.
        """
        path = os.path.join(
            MODULE_PATH, 'static', 'events', 'events.json')
        definitions = EventsDefinition(path=path)

        definitions.load()

        self.assertIsNotEmpty(definitions.getAllEventDefinitions())
        self.assertIsNotEmpty(definitions.getAllEventGroupDefinitions())
示例#2
0
文件: mockup.py 项目: chevah/utils
    def makeEventsDefinition(self,
            configuration_file=None, content=None,
            load=True,
            ):
        """Creates an EventHandler."""
        if configuration_file is None:
            if content is None:
                content = u''
            configuration_file = StringIO(content)

        config = EventsDefinition(file=configuration_file)

        if load:
            config.load()
        return config