| 22 | """ |
| 23 | |
| 24 | def setUp(self): |
| 25 | # Blindly copied from tests.integration.modules.file; Refactoring? |
| 26 | self.myfile = os.path.join(RUNTIME_VARS.TMP, "myfile") |
| 27 | with salt.utils.files.fopen(self.myfile, "w+") as fp: |
| 28 | fp.write("Hello\n") |
| 29 | self.mydir = os.path.join(RUNTIME_VARS.TMP, "mydir/isawesome") |
| 30 | if not os.path.isdir(self.mydir): |
| 31 | # left behind... Don't fail because of this! |
| 32 | os.makedirs(self.mydir) |
| 33 | self.mysymlink = os.path.join(RUNTIME_VARS.TMP, "mysymlink") |
| 34 | if os.path.islink(self.mysymlink): |
| 35 | os.remove(self.mysymlink) |
| 36 | os.symlink(self.myfile, self.mysymlink) |
| 37 | self.mybadsymlink = os.path.join(RUNTIME_VARS.TMP, "mybadsymlink") |
| 38 | if os.path.islink(self.mybadsymlink): |
| 39 | os.remove(self.mybadsymlink) |
| 40 | os.symlink("/nonexistentpath", self.mybadsymlink) |
| 41 | super().setUp() |
| 42 | |
| 43 | def tearDown(self): |
| 44 | if os.path.isfile(self.myfile): |