Add a couple error condition tests

This commit is contained in:
R. Tyler Ballance 2009-07-07 11:16:22 -07:00
parent 5057d4028e
commit 378b80fd6a
1 changed files with 11 additions and 0 deletions

View File

@ -90,6 +90,17 @@ class ECC_Decrypt_Tests(unittest.TestCase):
decrypted = self.ecc.decrypt(encrypted)
assert decrypted == DEFAULT_PLAINTEXT
class ECC_Fail(unittest.TestCase):
def setUp(self):
super(ECC_Fail, self).setUp()
self.ecc = pyecc.ECC(public=DEFAULT_PUBKEY, private=DEFAULT_PRIVKEY)
def test_EncryptNullByte(self):
rc = self.ecc.encrypt('\x00')
assert rc, (rc, 'Fail')
def test_EmptyString(self):
self.failUnlessRaises(TypeError, self.ecc.encrypt, '')
class ECC_GC_Checks(unittest.TestCase):
def setUp(self):