fix the 'test_allowed_devices' unittest

This commit is contained in:
lars 2008-07-17 19:54:06 +00:00
parent 3e79c98545
commit 0541981452
1 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,8 @@ import cryptobox.core.settings
from cryptobox.tests.base import CommonTestClass
import os
# which other devices are safe (cannot cause harm)?
COMMON_ALLOWED_DEVICES = [ '/dev/ubdb' ]
class CryptoBoxDeviceTests(CommonTestClass):
"""Some unittests for the CryptoBox
@ -41,8 +43,13 @@ class CryptoBoxDeviceTests(CommonTestClass):
def test_allowed_devices(self):
'''is_device_allowed should accept permitted devices'''
self.assertTrue(self.cb.is_device_allowed("/dev/ram1"))
self.assertTrue(self.cb.is_device_allowed("/dev/pts/../ram1"))
# check if one of the common devices exists and is allowed
blockdevice_found = False
for dev_node in COMMON_ALLOWED_DEVICES:
if os.path.exists(dev_node):
self.assertTrue(self.cb.is_device_allowed(dev_node))
blockdevice_found = True
self.assertTrue(blockdevice_found)
def test_denied_devices(self):