ok

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/OpenSSL/test/
Upload File :
Current File : //usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyc

�
o�[c@s�dZddlmZddlZddlZddlmZmZddlm	Z	defd��YZ
edkr�e�ndS(	s!
Unit tests for L{OpenSSL.rand}.
i����(tmainN(tTestCasetb(trandt	RandTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(cCsF|jttj�|jttjd�|jttjdd�dS(s�
        L{OpenSSL.rand.bytes} raises L{TypeError} if called with the wrong
        number of arguments or with a non-C{int} argument.
        iN(tassertRaisest	TypeErrorRtbytestNone(tself((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_bytes_wrong_argsscCs�tjd�}|jt|�d�tjdd�}|j||�tjdd�}|jt|�d�|jttjd�}|jt|�d�dS(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.
        i2t	num_bytesii����snum_bytes must not be negativeN(RRtassertEqualtlentassertNotEqualRt
ValueErrortstr(R	tb1tb2tb3texc((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyt
test_bytesscCsq|jttj�|jttjtd�d�|jttjdd�|jttjtd�dd�dS(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}.
        tfooiN(RRRtaddRR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_add_wrong_args,scCstjtd�d�dS(s?
        L{OpenSSL.rand.add} adds entropy to the PRNG.
        t	hamburgeriN(RRR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_add7scCsL|jttj�|jttjd�|jttjtd�d�dS(s�
        When called with the wrong number of arguments, or with a non-C{str}
        argument, L{OpenSSL.rand.seed} raises L{TypeError}.
        RN(RRRtseedRR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_seed_wrong_args>scCstjtd��dS(s@
        L{OpenSSL.rand.seed} adds entropy to the PRNG.
        s
milk shakeN(RRR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyt	test_seedHscCs|jttjd�dS(sd
        L{OpenSSL.rand.status} raises L{TypeError} when called with any
        arguments.
        N(RRRtstatusR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_status_wrong_argsOscCs|jtj�dk�dS(sx
        L{OpenSSL.rand.status} returns C{True} if the PRNG has sufficient
        entropy, C{False} otherwise.
        iiN(ii(t
assertTrueRR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_statusWscCs{|jttj�|jttjd�|jttjdd�|jttjdd�|jttjddd�dS(s�
        L{OpenSSL.rand.egd} raises L{TypeError} when called with the wrong
        number of arguments or with arguments not of type C{str} and C{int}.
        RiN(RRRtegdR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_egd_wrong_argsbs
cCs?tj|j��}d}|j||kd||f�dS(sr
        L{OpenSSL.rand.egd} returns C{0} or C{-1} if the EGD socket passed
        to it does not exist.
        i����is%r not in %rN(i����i(RR"tmktempR (R	tresulttexpected((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_egd_missingns
	cCs|jttjd�dS(se
        L{OpenSSL.rand.cleanup} raises L{TypeError} when called with any
        arguments.
        N(RRRtcleanupR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_cleanup_wrong_argszscCs|jtj�d�dS(sk
        L{OpenSSL.rand.cleanup} releases the memory used by the PRNG and returns
        C{None}.
        N(tassertIdenticalRR(R(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_cleanup�scCse|jttj�|jttjdd�|jttjdd�|jttjddd�dS(s�
        L{OpenSSL.rand.load_file} raises L{TypeError} when called the wrong
        number of arguments or arguments not of type C{str} and C{int}.
        RiN(RRRt	load_fileR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_load_file_wrong_args�scCsF|jttj�|jttjd�|jttjdd�dS(s�
        L{OpenSSL.rand.write_file} raises L{TypeError} when called with the
        wrong number of arguments or a non-C{str} argument.
        RN(RRRt
write_fileR(R	((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyttest_write_file_wrong_args�scCs�|j�}t|d�}|j�zTtj|�tj|�tj}|j|d�tj	|�tj	|d�Wdtj
|�XdS(sG
        Test reading and writing of files via rand functions.
        twiiN(R$topentcloseRR.toststattST_SIZEtassertEqualsR,tunlink(R	ttmpfiletfObjtsize((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyt
test_files�s


(t__name__t
__module__R
RRRRRRR!R#R'R)R+R-R/R;(((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyRs					
									
t__main__(t__doc__tunittestRR3R4tOpenSSL.test.utilRRtOpenSSLRRR<(((s</usr/lib64/python2.7/site-packages/OpenSSL/test/test_rand.pyt<module>s�

Zerion Mini Shell 1.0