From 31e505b39b48226e03ca3f00b0e7dce5c81fea90 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 3 Oct 2012 18:33:58 +0200 Subject: [PATCH] add tests --- tests/__init__.py | 0 tests/api.py | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/api.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/api.py b/tests/api.py new file mode 100644 index 0000000..6e52c4d --- /dev/null +++ b/tests/api.py @@ -0,0 +1,19 @@ +import unittest +import os.path + +import rfc3161 + +class Rfc3161(unittest.TestCase): + PUBLIC_TSA_SERVER = 'http://time.certum.pl' + CERTIFICATE = os.path.join(os.path.dirname(__file__), + '../data/certum_certificate.crt') + + def test_timestamp(self): + try: + certificate = file(self.CERTIFICATE).read() + value, substrate = rfc3161.RemoteTimestamper( + self.PUBLIC_TSA_SERVER, certificate=certificate)(data='xx') + except rfc3161.TimestampingError: + return + self.assertNotEqual(value, None) + self.assertEqual(substrate, '')