summaryrefslogtreecommitdiff
path: root/tests/test_asn1.py
diff options
context:
space:
mode:
authorHeikki Toivonen <heikki@heikkitoivonen.net>2005-05-14 10:09:58 +0000
committerHeikki Toivonen <heikki@heikkitoivonen.net>2005-05-14 10:09:58 +0000
commita5df0c7309693ae5db5ccb692283b97ae87c09a5 (patch)
tree149a8c119dee448e9b99345542c1c0888f0b1695 /tests/test_asn1.py
parent18aba85b43fad22a9c92e907b82b3b6c4393fe68 (diff)
downloadm2crypto-a5df0c7309693ae5db5ccb692283b97ae87c09a5.tar.gz
Test ASN1.
git-svn-id: http://svn.osafoundation.org/m2crypto/trunk@277 2715db39-9adf-0310-9c64-84f055769b4b
Diffstat (limited to 'tests/test_asn1.py')
-rw-r--r--tests/test_asn1.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test_asn1.py b/tests/test_asn1.py
new file mode 100644
index 0000000..11a8e2b
--- /dev/null
+++ b/tests/test_asn1.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+"""Unit tests for M2Crypto.ASN1.
+
+Copyright (c) 2005 Open Source Applications Foundation. All rights reserved."""
+
+RCS_id='$Id$'
+
+import unittest, time
+from M2Crypto import ASN1
+
+class ASN1TestCase(unittest.TestCase):
+
+ def check_Integer(self):
+ pass # XXX Dunno how to test
+
+ def check_BitSTring(self):
+ pass # XXX Dunno how to test
+
+ def check_String(self):
+ pass # XXX Dunno how to test
+
+ def check_Object(self):
+ pass # XXX Dunno how to test
+
+ def check_UTCTIME(self):
+ asn1 = ASN1.ASN1_UTCTIME()
+ assert str(asn1) == 'Bad time value'
+
+ asn1.set_string('990807053011Z')
+ assert str(asn1) == 'Aug 7 05:30:11 1999 GMT'
+
+ asn1.set_time(500)
+ assert str(asn1) == 'Jan 1 00:08:20 1970 GMT'
+
+ t = long(time.time()) + time.timezone
+ asn1.set_time(t)
+ t2 = time.strftime('%b %d %H:%M:%S %Y', time.gmtime(t))
+ assert str(asn1)[:-4] == str(t2)
+
+
+def suite():
+ return unittest.makeSuite(ASN1TestCase, 'check')
+
+
+if __name__ == '__main__':
+ unittest.TextTestRunner().run(suite())
+