bug 189466: fix typo in osrandom.py (from patch in bug report) and add a
friggin' unit test.
This commit is contained in:
Robey Pointer 2008-02-17 18:41:39 -08:00
parent 06faa6f2ed
commit d81e0038d2
2 changed files with 7 additions and 1 deletions

View File

@ -44,7 +44,7 @@ if osrandom_source is None:
try:
_dev_urandom = open("/dev/urandom", "rb", 0)
def urandom(bytes):
return _def_urandom.read(bytes)
return _dev_urandom.read(bytes)
osrandom_source = "/dev/urandom"
except (OSError, IOError):
pass

View File

@ -142,3 +142,9 @@ class UtilTest (unittest.TestCase):
finally:
os.unlink('hostfile.temp')
def test_6_random(self):
from paramiko.common import randpool
# just verify that we can pull out 32 bytes and not get an exception.
x = randpool.get_bytes(32)
self.assertEquals(len(x), 32)