def test_eq_subclass(self): class Subclass(MountConnection): pass c1 = MountConnection("server:/path", "vfstype", "options") c2 = Subclass("server:/path", "vfstype", "options") self.assertFalse(c1 == c2, "%s should not equal %s" % (c1, c2))
def test_subclass_different_hash(self): class Subclass(MountConnection): pass c1 = MountConnection("server:/path", "vfstype", "options") c2 = Subclass("server:/path", "vfstype", "options") self.assertNotEqual(hash(c1), hash(c2))
def test_eq_different(self, s1, s2, t1, t2, o1, o2): c1 = MountConnection(s1, t1, o1) c2 = MountConnection(s2, t2, o2) self.assertFalse(c1 == c2, "%s should not equal %s" % (c1, c2))
def test_eq_equal(self): c1 = MountConnection("server:/path", "vfstype", "options") c2 = MountConnection("server:/path", "vfstype", "options") self.assertTrue(c1 == c2, "%s should equal %s" % (c1, c2))
def test_normalize_local_path(self, spec, fs_spec, fs_file): con = MountConnection(spec, mountClass=FakeMount) self.assertEqual(con._mount.fs_spec, fs_spec) self.assertEqual(con._mount.fs_file, fs_file)
def test_not_equal_different_hash(self, s1, s2, t1, t2, o1, o2): c1 = MountConnection(s1, t1, o1) c2 = MountConnection(s2, t2, o2) self.assertNotEqual(hash(c1), hash(c2))
def test_equal_same_hash(self): c1 = MountConnection("server:/path", "vfstype", "options") c2 = MountConnection("server:/path", "vfstype", "options") self.assertEqual(hash(c1), hash(c2))
def test_ne_equal(self): c1 = MountConnection("spec", "vfstype", "options") c2 = MountConnection("spec", "vfstype", "options") self.assertFalse(c1 != c2, "%s should equal %s" % (c1, c2))
def test_mountpoint(self): mount_con = MountConnection("dummy-spec", mountClass=FakeMount) self.assertEquals(mount_con._mount.fs_spec, "dummy-spec") self.assertEquals(mount_con._mount.fs_file, "/tmp/dummy-spec")