Skip to content

Commit

Permalink
Extend tests to EphemeralFS constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed Dec 23, 2024
1 parent 4509418 commit 79e6c97
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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()

0 comments on commit 79e6c97

Please sign in to comment.