def test_fs_touch(self): """ Create(touch) a new file. """ file_target = tests.get_sandbox_path("file_to_touch.txt") self.assertFalse(os.path.exists(file_target)) fs.touch(file_target) self.assertTrue(os.path.exists(file_target)) fs.remove_existing(file_target)
def test_fs_remove_existing(self): """ Remove a file is it exists. """ file_target = tests.get_sandbox_path("remove_existing_file.txt") self.assertFalse(fs.remove_existing(file_target)) fs.touch(file_target) self.assertTrue(os.path.exists(file_target)) self.assertTrue(fs.remove_existing(file_target)) self.assertFalse(os.path.exists(file_target))
def setUp(self): """ Application configuration file will be read and components will be loaded. """ self.file_to_read = "cartola_sandbox.txt" self.file_to_read_path = tests.get_sandbox_path(self.file_to_read) self.file_to_write = "cartola_file_write_test.txt" self.file_to_write_path = tests.get_sandbox_path(self.file_to_write) fs.remove_existing(self.file_to_write_path)
def tearDown(self): fs.remove_existing(tests.get_sandbox_path( os.path.join("monster", "__init__.py"))) fs.remove_existing(tests.get_sandbox_path( os.path.join("monster", "of", "__init__.py"))) fs.remove_existing(tests.get_sandbox_path( os.path.join("monster", "of", "the", "__init__.py"))) fs.remove_existing(tests.get_sandbox_path( os.path.join("monster", "of", "the", "lake", "__init__.py"))) fs.rmdir_existing(tests.get_sandbox_path( os.path.join("monster", "of", "the", "lake"))) fs.rmdir_existing(tests.get_sandbox_path( os.path.join("monster", "of", "the"))) fs.rmdir_existing(tests.get_sandbox_path( os.path.join("monster", "of"))) fs.rmdir_existing(tests.get_sandbox_path( os.path.join("monster")))
def tearDown(self): fs.remove_existing(self.file_to_write_path)