From c68c9190244d55d360802959e103ff8f46a0ffad Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Tue, 18 Jun 2024 17:34:17 -0700 Subject: [PATCH] add mount test --- .../fixtures/generic/mount-spaces-in-filename.json | 1 + tests/fixtures/generic/mount-spaces-in-filename.out | 1 + tests/test_mount.py | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 tests/fixtures/generic/mount-spaces-in-filename.json create mode 100644 tests/fixtures/generic/mount-spaces-in-filename.out diff --git a/tests/fixtures/generic/mount-spaces-in-filename.json b/tests/fixtures/generic/mount-spaces-in-filename.json new file mode 100644 index 00000000..4fa4bd32 --- /dev/null +++ b/tests/fixtures/generic/mount-spaces-in-filename.json @@ -0,0 +1 @@ +[{"filesystem":"//10.100.1.237/Bilder und Videos","mount_point":"/mnt/smb/thw/media","type":"cifs","options":["rw","nosuid","nodev","relatime","vers=2.1","cache=strict","username=iweinmann","uid=1000","noforceuid","gid=1000","noforcegid","addr=10.100.1.237","file_mode=0755","dir_mode=0755","iocharset=utf8","soft","nounix","serverino","mapposix","rsize=1048576","wsize=1048576","bsize=1048576","retrans=1","echo_interval=60","actimeo=1","closetimeo=1","user=ingo"]}] diff --git a/tests/fixtures/generic/mount-spaces-in-filename.out b/tests/fixtures/generic/mount-spaces-in-filename.out new file mode 100644 index 00000000..491f891a --- /dev/null +++ b/tests/fixtures/generic/mount-spaces-in-filename.out @@ -0,0 +1 @@ +//10.100.1.237/Bilder und Videos on /mnt/smb/thw/media type cifs (rw,nosuid,nodev,relatime,vers=2.1,cache=strict,username=iweinmann,uid=1000,noforceuid,gid=1000,noforcegid,addr=10.100.1.237,file_mode=0755,dir_mode=0755,iocharset=utf8,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,retrans=1,echo_interval=60,actimeo=1,closetimeo=1,user=ingo) diff --git a/tests/test_mount.py b/tests/test_mount.py index f1d6bca9..895730cb 100644 --- a/tests/test_mount.py +++ b/tests/test_mount.py @@ -27,6 +27,10 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/mount-spaces-in-mountpoint.out'), 'r', encoding='utf-8') as f: generic_mount_spaces_in_mountpoint = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/mount-spaces-in-filename.out'), 'r', encoding='utf-8') as f: + generic_mount_spaces_in_filename = f.read() + + # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/mount.json'), 'r', encoding='utf-8') as f: centos_7_7_mount_json = json.loads(f.read()) @@ -46,6 +50,9 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/mount-spaces-in-mountpoint.json'), 'r', encoding='utf-8') as f: generic_mount_spaces_in_mountpoint_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/mount-spaces-in-filename.json'), 'r', encoding='utf-8') as f: + generic_mount_spaces_in_filename_json = json.loads(f.read()) + def test_mount_nodata(self): """ @@ -89,6 +96,12 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.mount.parse(self.generic_mount_spaces_in_mountpoint, quiet=True), self.generic_mount_spaces_in_mountpoint_json) + def test_mount_spaces_in_filename(self): + """ + Test 'mount' with spaces in the filename + """ + self.assertEqual(jc.parsers.mount.parse(self.generic_mount_spaces_in_filename, quiet=True), self.generic_mount_spaces_in_filename_json) + if __name__ == '__main__': unittest.main()