def test_etc_only(self): with self.patch_getters() as (proc, etc): with open(join(dirname(__file__), "etc")) as fd: etc.return_value = fd.read() actual = LinuxSupportedFileSystemsMixin( ).get_supported_file_systems() expected = ['hfsplus', 'ext3', 'ext2', 'iso9660', 'hfs', 'vfat'] self.assertEqual(set(actual), set(expected))
def test_proc_only(self): with self.patch_getters() as (proc, etc): with open(join(dirname(__file__), "proc")) as fd: proc.return_value = fd.read() actual = LinuxSupportedFileSystemsMixin( ).get_supported_file_systems() expected = ["ext3", "iso9660"] self.assertEqual(set(actual), set(expected))
def test_helpers_only(self): import glob with self.patch_getters(): with patch.object(glob, "glob") as _glob: _glob.return_value = [ "/sbin/mount.{}".format(name) for name in ['ntfs', 'nfs', 'cifs'] ] actual = LinuxSupportedFileSystemsMixin( ).get_supported_file_systems() expected = ['ntfs', 'nfs', 'cifs'] self.assertEqual(set(actual), set(expected))
def test_internal_and_helpers__same_data(self): import glob with patch.object(glob, "glob") as _glob: _glob.return_value = [ "/sbin/mount.{}".format(name) for name in ['ext3', 'hfs'] ] with self.patch_getters() as (proc, etc): proc.return_value = "hfs\next3" with open(join(dirname(__file__), "etc")) as fd: etc.return_value = fd.read() + "\n*" actual = LinuxSupportedFileSystemsMixin( ).get_supported_file_systems() expected = [ 'hfsplus', 'ext3', 'ext2', 'iso9660', 'hfs', 'vfat' ] self.assertEqual(set(actual), set(expected))
def test_empty_list(self): with self.patch_getters() as (proc, etc): actual = LinuxSupportedFileSystemsMixin( ).get_supported_file_systems() expected = [] self.assertEqual(set(actual), set(expected))