Exemplo n.º 1
0
    def __call__(cls, *args, **kwargs):
        r = super(LayerType, cls).__call__(*args, **kwargs)
        if outline.current_outline() and r.get_arg("register"):
            outline.current_outline().add_layer(r)

        # Initialize with plugin system.  This is imported
        # here to get past a circular dependency.
        # pylint: disable=import-outside-toplevel
        from outline.plugins import PluginManager
        for plugin in PluginManager.get_plugins():
            try:
                plugin.init(r)
            except AttributeError:
                pass
        return r
Exemplo n.º 2
0
    def test_script_parse(self):
        """
        Test to ensure a basic outline script parses.
        """
        path = os.path.join(SCRIPTS_DIR, 'shell.outline')
        ol = outline.load_outline(path)

        # check to ensure the loader returns the correct type.
        self.assertTrue(isinstance(ol, outline.Outline))

        # Ensure the path is the same
        self.assertEqual(path, ol.get_path())

        # Ensure the single event has been loaded
        self.assertEqual(1, len(ol.get_layers()))

        # ensure that outline returned from load_outline is
        # the same as current_outline
        self.assertEqual(ol, outline.current_outline())
Exemplo n.º 3
0
    def test_serialized_parse(self):
        """
        Test to ensure a serialized outline parses.
        """
        ## Yaml likes to have the full path or else it refuses to parse.
        path = "./scripts/yamlized.yaml"
        ol = outline.load_outline(path)

        # check to ensure the loader returns the correct type.
        self.assertTrue(isinstance(ol,outline.Outline))

        # Ensure the path is the same
        self.assertEquals(path, ol.get_path())

        # Ensure the single event has been loaded
        self.assertEquals(1, len(ol.get_layers()))

        # ensure that outline returned from load_outline is
        # the same as current_outline
        self.assertEquals(ol, outline.current_outline())
Exemplo n.º 4
0
    def test_serialized_parse(self):
        """
        Test to ensure a serialized outline parses.
        """
        filename = 'yamlized.yaml'
        pathOnDisk = os.path.join(SCRIPTS_DIR, filename)
        pathInYaml = './scripts/' + filename
        ol = outline.load_outline(pathOnDisk)

        # check to ensure the loader returns the correct type.
        self.assertTrue(isinstance(ol, outline.Outline))

        # Ensure the path is the same
        self.assertEqual(pathInYaml, ol.get_path())

        # Ensure the single event has been loaded
        self.assertEqual(1, len(ol.get_layers()))

        # ensure that outline returned from load_outline is
        # the same as current_outline
        self.assertEqual(ol, outline.current_outline())