Current Path : /usr/lib/python2.7/dist-packages/OpenSSL/test/ |
Current File : //usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.pyc |
ʐMc @ s d Z d d l m Z d d l Z d d l Z d d l m Z m Z d d l m Z d e f d YZ e d k r e n d S( s! Unit tests for L{OpenSSL.rand}. i( t mainN( t TestCaset b( t randt RandTestsc B s e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( c C sF | j t t j | j t t j d | j t t j d d d S( s L{OpenSSL.rand.bytes} raises L{TypeError} if called with the wrong number of arguments or with a non-C{int} argument. i N( t assertRaisest TypeErrorR t bytest None( t self( ( s: /usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.pyt test_bytes_wrong_args s c C s t j d } | j t | d t j d d } | j | | t j d d } | j t | d | j t t j d } | j t | d d S( s Verify that we can obtain bytes from rand_bytes() and that they are different each time. Test the parameter of rand_bytes() for bad values. i2 t num_bytesi is num_bytes must not be negativeN( R R t assertEqualt lent assertNotEqualR t ValueErrort str( R t b1t b2t b3t exc( ( s: /usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.pyt test_bytes s c C sq | j t t j | j t t j t d d | j t t j d d | j t t j t d d d d S( s When called with the wrong number of arguments, or with arguments not of type C{str} and C{int}, L{OpenSSL.rand.add} raises L{TypeError}. t fooi N( R R R t addR R ( R ( ( s: /usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.pyt test_add_wrong_args, s c C s t j t d d d S( s? L{OpenSSL.rand.add} adds entropy to the PRNG. t hamburgeri N( R R R ( R ( ( s: /usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.pyt test_add7 s c C sL | j t t j | j t t j d | j t t j t d d d S( s When called with the wrong number of arguments, or with a non-C{str} argument, L{OpenSSL.rand.seed} raises L{TypeError}. R N( R R R t seedR R ( R ( ( s: /usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.pyt test_seed_wrong_args>