summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2008-07-12 00:06:52 -0400
committerLuke Macken <lmacken@redhat.com>2008-07-12 00:06:52 -0400
commit528680f99122028a34e308a931d2227727bff053 (patch)
tree7562485ff6c88a26d0980dab5ed1a02983816119 /tests
parente3e3b47f98e4f046e659ab660e5d68012585d786 (diff)
Write a test_mount_device unit test
Diffstat (limited to 'tests')
-rw-r--r--tests/test_creator.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_creator.py b/tests/test_creator.py
index 6214c8a..31bb94b 100644
--- a/tests/test_creator.py
+++ b/tests/test_creator.py
@@ -1,3 +1,4 @@
+import os
class LiveUSBCreatorOptions(object):
console = True
@@ -34,3 +35,24 @@ class TestLiveUSBCreator:
assert release['name']
assert release['url']
assert release['sha1'] and len(release['sha1']) == 40
+
+ def test_mount_device(self):
+ live = self._get_creator()
+ live.detect_removable_drives()
+ for drive in live.drives:
+ live.drive = drive
+ if live.drive['mount']:
+ assert not live.drive['unmount']
+ assert os.path.exists(live.drive['mount'])
+ # this method will only unmount if we have mounted it first
+ live.unmount_device()
+ assert os.path.exists(live.drive['mount'])
+ # fake it out, forcing it to unmount
+ live.dest = live.drive['mount']
+ live.drive['unmount'] = True
+ live.unmount_device()
+ assert not live.drive['mount'] and not live.drive['unmount']
+ live.mount_device()
+ assert live.drive['mount'] # make sure we set the mountpoint
+ assert live.drive['unmount'] # make sure we know to unmount this
+ assert os.path.exists(live.drive['mount']), live.drive