Пример #1
0
  def testCreateMultipleNonce(self):
    """createNonce() multiple"""
    # test that no two consecutive hashes are the same
    def check(nonce, nextnonce):
      self.assertNotEqual(nonce, nextnonce)
      return nextnonce

    reduce(check, [pychap.createNonce('x') for n in range(100)])
Пример #2
0
 def testCreateNonce(self):
   """createNonce()"""
   nonce = pychap.createNonce('some_user_name')
   assert isinstance(nonce, basestring), \
       'createNonce() is expected to return a string.'
   self.assertEqual(len(nonce), 40)