MCPcopy Index your code
hub / github.com/saltstack/salt / test_add_dir

Method test_add_dir

tests/integration/modules/test_git.py:141–158  ·  view source on GitHub ↗

Test git.add with a directory

(self)

Source from the content-addressed store, hash-verified

139
140 @pytest.mark.slow_test
141 def test_add_dir(self):
142 """
143 Test git.add with a directory
144 """
145 newdir = "quux"
146 # Change to the repo dir
147 newdir_path = pathlib.Path(self.repo) / newdir
148 newdir_path.mkdir(parents=True, exist_ok=True)
149 files = [str(newdir_path / x) for x in self.files]
150 files_relpath = [os.path.join(newdir, x) for x in self.files]
151 for path in files:
152 with salt.utils.files.fopen(path, "wb") as fp_:
153 fp_.write(f"This is a test file with relative path {path}.\n".encode())
154 ret = self.run_function("git.add", [self.repo, newdir])
155 res = "\n".join(sorted(f"add '{x}'" for x in files_relpath))
156 if salt.utils.platform.is_windows():
157 res = res.replace("\\", "/")
158 self.assertEqual(ret, res)
159
160 @pytest.mark.slow_test
161 def test_add_file(self):

Callers

nothing calls this directly

Calls 2

run_functionMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected