Test git.archive
(self)
| 175 | |
| 176 | @pytest.mark.slow_test |
| 177 | def test_archive(self): |
| 178 | """ |
| 179 | Test git.archive |
| 180 | """ |
| 181 | tar_archive = os.path.join(RUNTIME_VARS.TMP, "test_archive.tar.gz") |
| 182 | try: |
| 183 | self.assertTrue( |
| 184 | self.run_function( |
| 185 | "git.archive", [self.repo, tar_archive], prefix="foo/" |
| 186 | ) |
| 187 | ) |
| 188 | self.assertTrue(tarfile.is_tarfile(tar_archive)) |
| 189 | self.run_function("cmd.run", ["cp " + tar_archive + " /root/"]) |
| 190 | with closing(tarfile.open(tar_archive, "r")) as tar_obj: |
| 191 | self.assertEqual( |
| 192 | sorted(salt.utils.data.decode(tar_obj.getnames())), |
| 193 | sorted( |
| 194 | [ |
| 195 | "foo", |
| 196 | "foo/bar", |
| 197 | "foo/baz", |
| 198 | "foo/foo", |
| 199 | "foo/питон", |
| 200 | "foo/qux", |
| 201 | "foo/qux/bar", |
| 202 | "foo/qux/baz", |
| 203 | "foo/qux/foo", |
| 204 | "foo/qux/питон", |
| 205 | ] |
| 206 | ), |
| 207 | ) |
| 208 | finally: |
| 209 | try: |
| 210 | os.unlink(tar_archive) |
| 211 | except OSError: |
| 212 | pass |
| 213 | |
| 214 | @pytest.mark.slow_test |
| 215 | def test_archive_subdir(self): |
nothing calls this directly
no test coverage detected