'Mounting a device to n different locations requires n unmounts.
Also verify they are unmounted in LIFO order.'

def test_mount_multiple_times(self):

    blockdevice = self._get_free_blockdevice()
    self.manager_under_test.make_filesystem(blockdevice, 'ext4')
    mountpoints = list((self._get_directory_for_mount() for _ in xrange(4)))
    for mountpoint in mountpoints:
        self.manager_under_test.mount(blockdevice, mountpoint)
    mount_infos = list((MountInfo(blockdevice=blockdevice, mountpoint=mountpoint) for mountpoint in mountpoints))
    while mount_infos:
        self.assertSetEqual(set(mount_infos), set((m for m in self.manager_under_test.get_mounts() if (m.blockdevice == blockdevice))))
        self.manager_under_test.unmount(blockdevice)
        mount_infos.pop()
    self.assertFalse(any(((m.blockdevice == blockdevice) for m in self.manager_under_test.get_mounts())))
