Nir Soffer has uploaded a new change for review.

Change subject: tests: Add Mount equality and hash tests
......................................................................

tests: Add Mount equality and hash tests

The relevant code has not tests and I want to clean it up, so lets have
some tests to make sure the cleanup does not break anything.

Change-Id: Ie958119aebfd2a5f96df14e9bba68a0c4f16f094
Signed-off-by: Nir Soffer <[email protected]>
---
M tests/mountTests.py
1 file changed, 37 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/43975/1

diff --git a/tests/mountTests.py b/tests/mountTests.py
index 16a98b9..a6d9e54 100644
--- a/tests/mountTests.py
+++ b/tests/mountTests.py
@@ -28,7 +28,7 @@
 from nose.plugins.skip import SkipTest
 
 from testlib import VdsmTestCase as TestCaseBase
-from testlib import namedTemporaryDir
+from testlib import namedTemporaryDir, expandPermutations, permutations
 from storage.misc import execCmd
 import storage.mount as mount
 from testValidation import checkSudo
@@ -62,6 +62,42 @@
         os.unlink(path)
 
 
+@expandPermutations
+class TestMountEquality(TestCaseBase):
+
+    def test_eq(self):
+        m1 = mount.Mount("spec", "file")
+        m2 = mount.Mount("spec", "file")
+        self.assertEqual(m1, m2)
+
+    @permutations([
+        ("spec", "spec", "file1", "file2"),
+        ("spec1", "spec2", "file", "file"),
+    ])
+    def test_ne(self, spec1, spec2, file1, file2):
+        m1 = mount.Mount(spec1, file1)
+        m2 = mount.Mount(spec2, file2)
+        self.assertNotEqual(m1, m2)
+
+
+@expandPermutations
+class TestMountHash(TestCaseBase):
+
+    def test_eq(self):
+        m1 = mount.Mount("spec", "file")
+        m2 = mount.Mount("spec", "file")
+        self.assertEqual(hash(m1), hash(m2))
+
+    @permutations([
+        ("spec", "spec", "file1", "file2"),
+        ("spec1", "spec2", "file", "file"),
+    ])
+    def test_ne(self, spec1, spec2, file1, file2):
+        m1 = mount.Mount(spec1, file1)
+        m2 = mount.Mount(spec2, file2)
+        self.assertNotEqual(hash(m1), hash(m2))
+
+
 class MountTests(TestCaseBase):
     def testLoopMount(self):
         checkSudo(["mount", "-o", "loop", "somefile", "target"])


-- 
To view, visit https://gerrit.ovirt.org/43975
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie958119aebfd2a5f96df14e9bba68a0c4f16f094
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to