Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/google-endpoints/Crypto/SelfTest/Random/test_rpoolcompat.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2 #
3 # SelfTest/Util/test_winrandom.py: Self-test for the winrandom module
4 #
5 # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
6 #
7 # ===================================================================
8 # The contents of this file are dedicated to the public domain. To
9 # the extent that dedication to the public domain is not available,
10 # everyone is granted a worldwide, perpetual, royalty-free,
11 # non-exclusive license to exercise all rights associated with the
12 # contents of this file for any purpose whatsoever.
13 # No rights are reserved.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 # SOFTWARE.
23 # ===================================================================
24
25 """Self-test for the Crypto.Util.randpool.RandomPool wrapper class"""
26
27 __revision__ = "$Id$"
28
29 import sys
30 import unittest
31
32 class SimpleTest(unittest.TestCase):
33 def runTest(self):
34 """Crypto.Util.randpool.RandomPool"""
35 # Import the winrandom module and try to use it
36 from Crypto.Util.randpool import RandomPool
37 sys.stderr.write("SelfTest: You can ignore the RandomPool_DeprecationWar ning that follows.\n")
38 rpool = RandomPool()
39 x = rpool.get_bytes(16)
40 y = rpool.get_bytes(16)
41 self.assertNotEqual(x, y)
42 self.assertNotEqual(rpool.entropy, 0)
43
44 rpool.randomize()
45 rpool.stir('foo')
46 rpool.add_event('foo')
47
48 def get_tests(config={}):
49 return [SimpleTest()]
50
51 if __name__ == '__main__':
52 suite = lambda: unittest.TestSuite(get_tests())
53 unittest.main(defaultTest='suite')
54
55 # vim:set ts=4 sw=4 sts=4 expandtab:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698