Пример #1
0
 def test_fstab_with_duplicate_mount_point(self):
     result = cifsfixer._cifs_lines(
         self.fstab_with_duplicate_mount_point)[0]
     # In case of duplicates, the second one wins. A warning is logged (but
     # we don't test that here).
     self.assertEqual(result["/some/mount"]["cifs_share"],
                      "//someserver/something")
Пример #2
0
 def test_fstab_with_duplicate_mount(self):
     expected_keys = ["/some/mount1", "/some/mount2"]
     # In case of a file system that is mounted in two places, both are
     # returned. A warning is logged, but we don't test that here).
     self.assertEqual(
         expected_keys,
         sorted(
             cifsfixer._cifs_lines(
                 self.fstab_with_duplicate_mount)[0].keys()),
     )
Пример #3
0
 def test_mtab_with_duplicate_mount(self):
     with patch("serverscripts.cifsfixer._unmount") as mocked:
         mounts, warnings = cifsfixer._cifs_lines(
             self.mtab_with_duplicate_mount, unmount_duplicates=True)
         assert mounts == {
             "/some/mount": {
                 "cifs_share": "//someserver/somewhere"
             }
         }
         assert warnings == 1
         assert mocked.called
Пример #4
0
 def test_fstab(self):
     expected = {
         "/some/mount": {
             "cifs_share": "//someserver/somewhere",
             "options": {
                 "credentials": "/etc/blabla.txt",
                 "iocharset": "utf8"
             },
         }
     }
     # So: only cifs mounts are returned and commented-out cifs mounts are
     # ignored.
     self.assertEqual(expected, cifsfixer._cifs_lines(self.fstab)[0])
Пример #5
0
 def test_mtab(self):
     expected = {"/some/mount": {"cifs_share": "//someserver/somewhere"}}
     # So: only cifs mounts are returned and commented-out cifs mounts are
     # ignored.
     self.assertEqual(expected, cifsfixer._cifs_lines(self.mtab)[0])