示例#1
0
    def test__expand_path_with_wildcard_in_parent_node(self):
        """
        Should raise an excecption.
        :return:
        """
        from artefact.localhost.file import FileCopy
        from businesslogic.errors import TreePathError

        tree = FileCopy(parent=None, parameters={})
        with self.assertRaises(TreePathError):
            tree._expand_path("/not_*_allowed/*")
示例#2
0
    def test__expand_path_with_no_wildcard(self):
        """
        Should return the input value in a list.
        :return:
        """
        from artefact.localhost.file import FileCopy

        expected = ['.']
        tree = FileCopy(parameters={}, parent=None)
        actual = tree._expand_path('.')

        self.assertEqual(expected, actual)
示例#3
0
    def test__expand_path_with_wildcard_in_folder_name_in_leaf(self):
        """
        Should return list with all subdirectories which do match with wildcard text
        :return:
        """
        from artefact.localhost.file import FileCopy

        expected = ['./testfiles', './testtree']
        tree = FileCopy(parameters={}, parent=None)
        actual = tree._expand_path('./test*')

        self.assertEqual(expected, actual)
示例#4
0
    def test__expand_path_with_wildcard_in_leaf(self):
        """
        Should add a path for every directory in the leaf fitting the wildcard to _tree_path.
        :return:
        """
        from artefact.localhost.file import FileCopy

        expected = [
            './instructions', './testfiles', './copydestination', './support',
            './testtree'
        ]
        tree = FileCopy(parameters={}, parent=None)
        actual = tree._expand_path(f"./{tree._WILDCARD}")

        self.assertEqual(expected, actual)