Loading gitlab_butler/butler.py +4 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,10 @@ class Butler: return "" if path == self.group_path else path[len(self.group_path) + 1 :] def is_excluded(self, path: str) -> bool: # in case of shared projects, the project path will likely be outside initial group path if not path.startswith(self.group_path): return True return self.rel_path(path) in self.exclude def load_cfg(self, project: Project) -> ButlerCfg: Loading tests/test_basic_functions.py +3 −0 Original line number Diff line number Diff line Loading @@ -104,17 +104,20 @@ class TestBasic: butler.exclude = [] assert butler.is_excluded("path/to/group") is False assert butler.is_excluded("path/to/group/project") is False assert butler.is_excluded("shared/project") is True # exclude array contains project butler.exclude = ["project"] assert butler.is_excluded("path/to/group") is False assert butler.is_excluded("path/to/group/project") is True assert butler.is_excluded("shared/project") is True # exclude array contains subgroup butler.exclude = ["subgroup"] assert butler.is_excluded("path/to/group") is False assert butler.is_excluded("path/to/group/subgroup") is True assert butler.is_excluded("path/to/group/subgroup/project") is False assert butler.is_excluded("shared/project") is True @responses.activate def test_load_cfg(self) -> None: Loading Loading
gitlab_butler/butler.py +4 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,10 @@ class Butler: return "" if path == self.group_path else path[len(self.group_path) + 1 :] def is_excluded(self, path: str) -> bool: # in case of shared projects, the project path will likely be outside initial group path if not path.startswith(self.group_path): return True return self.rel_path(path) in self.exclude def load_cfg(self, project: Project) -> ButlerCfg: Loading
tests/test_basic_functions.py +3 −0 Original line number Diff line number Diff line Loading @@ -104,17 +104,20 @@ class TestBasic: butler.exclude = [] assert butler.is_excluded("path/to/group") is False assert butler.is_excluded("path/to/group/project") is False assert butler.is_excluded("shared/project") is True # exclude array contains project butler.exclude = ["project"] assert butler.is_excluded("path/to/group") is False assert butler.is_excluded("path/to/group/project") is True assert butler.is_excluded("shared/project") is True # exclude array contains subgroup butler.exclude = ["subgroup"] assert butler.is_excluded("path/to/group") is False assert butler.is_excluded("path/to/group/subgroup") is True assert butler.is_excluded("path/to/group/subgroup/project") is False assert butler.is_excluded("shared/project") is True @responses.activate def test_load_cfg(self) -> None: Loading