aboutsummaryrefslogtreecommitdiffstats
path: root/t/23-wait-for-insert.t
diff options
context:
space:
mode:
Diffstat (limited to 't/23-wait-for-insert.t')
-rw-r--r--t/23-wait-for-insert.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/23-wait-for-insert.t b/t/23-wait-for-insert.t
new file mode 100644
index 0000000..eb822d0
--- /dev/null
+++ b/t/23-wait-for-insert.t
@@ -0,0 +1,22 @@
+use strict;
+use lib 't';
+use helper;
+use Test::More;
+plan skip_all => "You need to be root to run this test" if $> != 0;
+plan skip_all => "The scsi_debug kernel module is needed to run this test" if !can_create_fake_media();
+
+use_ok('Hal::Cdroms');
+
+my $fake_device = create_fake_media(3);
+
+my $cdroms = Hal::Cdroms->new;
+
+my $udisks_path = $cdroms->wait_for_insert(10000);
+ok($udisks_path eq "/org/freedesktop/UDisks2/block_devices/$fake_device", 'wait_for_insert returns correct path');
+
+done_testing();
+
+END {
+ system("umount /dev/$fake_device") if find_mount_point($fake_device);
+ remove_fake_media() if $> == 0;
+}