Пример #1
0
 def test_multiple_folders(self):
     """Test multiple folder creation."""
     Folders.create(self.tmp_dir, ["foo", "bar"])
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     assert os.path.exists(os.path.join(self.tmp_dir, "bar"))
     os.rmdir(os.path.join(self.tmp_dir, "foo"))
     os.rmdir(os.path.join(self.tmp_dir, "bar"))
Пример #2
0
    def test_create_tuple(self):
        dirpath = tempfile.mkdtemp()
        Folders.create(dirpath, "foo")
        Files.create((dirpath, "foo"), "a.txt", b"bar")

        filepath = os.path.join(dirpath, "foo", "a.txt")
        assert open(filepath, "rb").read() == b"bar"
Пример #3
0
 def test_create_invld_linux(self):
     """Test creation of a folder we can't access."""
     with pytest.raises(CuckooOperationalError):
         Folders.create("/invalid/directory")
Пример #4
0
 def test_delete_folder2(self):
     """Test folder deletion #2."""
     Folders.create(self.tmp_dir, "foo")
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     Folders.delete(self.tmp_dir, "foo")
     assert not os.path.exists(os.path.join(self.tmp_dir, "foo"))
Пример #5
0
 def test_duplicate_folder(self):
     """Test a duplicate folder creation."""
     Folders.create(self.tmp_dir, "foo")
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     Folders.create(self.tmp_dir, "foo")
     os.rmdir(os.path.join(self.tmp_dir, "foo"))
Пример #6
0
 def test_single_folder(self):
     """Test single folder creation."""
     Folders.create(self.tmp_dir, "foo")
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     os.rmdir(os.path.join(self.tmp_dir, "foo"))
Пример #7
0
 def test_root_folder(self):
     """Test single folder creation based on the root parameter."""
     Folders.create(os.path.join(self.tmp_dir, "foo"))
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     os.rmdir(os.path.join(self.tmp_dir, "foo"))
Пример #8
0
 def test_create_invld_windows(self):
     """Test creation of a folder we can't access."""
     with pytest.raises(CuckooOperationalError):
         Folders.create("Z:\\invalid\\directory")