diff --git a/tests/test.py b/tests/test.py index b041e50..31f5953 100644 --- a/tests/test.py +++ b/tests/test.py @@ -2,13 +2,15 @@ import os import shutil import stat +import tempfile import unittest -from fuse import FuseOSError +from contextlib import redirect_stdout, redirect_stderr +from fuse import FUSE, FuseOSError from tempfile import mkdtemp from unittest.mock import patch, MagicMock -from globaleaks_eph_fs import EphemeralFile, EphemeralOperations +from globaleaks_eph_fs import EphemeralFS, EphemeralFile, EphemeralOperations TEST_PATH = 'TESTFILE.TXT' TEST_DATA = b"Hello, world! This is a test data for writing, seeking and reading operations." @@ -194,5 +196,14 @@ def test_chown_permission_error(self, mock_chown): with self.assertRaises(PermissionError): self.fs.chown(TEST_PATH, self.current_uid, self.current_gid) +class TestEphemeralFS(unittest.TestCase): + @patch.object(FUSE, '__init__', lambda x, *args, **kwargs: None) + def test_ephemeral_fs_initialization(self): + with tempfile.TemporaryDirectory() as mount_point, tempfile.TemporaryDirectory() as storage_dir: + fs = EphemeralFS(mount_point, storage_dir) + + self.assertEqual(fs.mount_point, mount_point) + self.assertEqual(fs.storage_directory, storage_dir) + if __name__ == '__main__': unittest.main()