fix the 'test_allowed_devices' unittest
This commit is contained in:
parent
3e79c98545
commit
0541981452
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue