def test_fstab_detect_snapshot(self, mock_commands): # Using python-mock 0.7 style, for precise compatibility mock_commands.side_effect = lambda f: f == 'btrfs' apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab")) self.assertTrue(apt_btrfs.snapshots_supported()) apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab.no-btrfs")) self.assertFalse(apt_btrfs.snapshots_supported()) apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab.bug806065")) self.assertFalse(apt_btrfs.snapshots_supported()) apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab.bug872145")) self.assertTrue(apt_btrfs.snapshots_supported())
def test_fstab_detect_snapshot(self, mock_commands): #Using python-mock 0.7 style, for precise compatibility mock_commands.side_effect = lambda f: f in ('/sbin/btrfs') apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab")) self.assertTrue(apt_btrfs.snapshots_supported()) apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab.no-btrfs")) self.assertFalse(apt_btrfs.snapshots_supported()) apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab.bug806065")) self.assertFalse(apt_btrfs.snapshots_supported()) apt_btrfs = AptBtrfsSnapshot( fstab=os.path.join(self.testdir, "data", "fstab.bug872145")) self.assertTrue(apt_btrfs.snapshots_supported())