Back to index

python3.2  3.2.2
Public Member Functions
test.test_hmac.CopyTestCase Class Reference

List of all members.

Public Member Functions

def test_attributes
def test_realcopy
def test_equality

Detailed Description

Definition at line 271 of file test_hmac.py.


Member Function Documentation

Definition at line 273 of file test_hmac.py.

00273 
00274     def test_attributes(self):
00275         # Testing if attributes are of same type.
00276         h1 = hmac.HMAC(b"key")
00277         h2 = h1.copy()
00278         self.assertTrue(h1.digest_cons == h2.digest_cons,
00279             "digest constructors don't match.")
00280         self.assertEqual(type(h1.inner), type(h2.inner),
00281             "Types of inner don't match.")
00282         self.assertEqual(type(h1.outer), type(h2.outer),
00283             "Types of outer don't match.")

Here is the call graph for this function:

Definition at line 295 of file test_hmac.py.

00295 
00296     def test_equality(self):
00297         # Testing if the copy has the same digests.
00298         h1 = hmac.HMAC(b"key")
00299         h1.update(b"some random text")
00300         h2 = h1.copy()
00301         self.assertEqual(h1.digest(), h2.digest(),
00302             "Digest of copy doesn't match original digest.")
00303         self.assertEqual(h1.hexdigest(), h2.hexdigest(),
00304             "Hexdigest of copy doesn't match original hexdigest.")

Here is the call graph for this function:

Definition at line 284 of file test_hmac.py.

00284 
00285     def test_realcopy(self):
00286         # Testing if the copy method created a real copy.
00287         h1 = hmac.HMAC(b"key")
00288         h2 = h1.copy()
00289         # Using id() in case somebody has overridden __eq__/__ne__.
00290         self.assertTrue(id(h1) != id(h2), "No real copy of the HMAC instance.")
00291         self.assertTrue(id(h1.inner) != id(h2.inner),
00292             "No real copy of the attribute 'inner'.")
00293         self.assertTrue(id(h1.outer) != id(h2.outer),
00294             "No real copy of the attribute 'outer'.")

Here is the call graph for this function:


The documentation for this class was generated from the following file: