aboutsummaryrefslogtreecommitdiff
path: root/tests/test_rfc2315.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-09-13 01:09:14 +0200
committerIlya Etingof <etingof@gmail.com>2017-09-13 01:09:14 +0200
commit49d39b1e21c7d0817b4ea3e69ffb70af97fa2da2 (patch)
treef1c30b8c6fbfc167d0e9b47d35b2bc06c03a23dc /tests/test_rfc2315.py
parentc513c62dd72b3afbe4fc1e7eb4856f0f9ac76954 (diff)
downloadpyasn1-modules-49d39b1e21c7d0817b4ea3e69ffb70af97fa2da2.tar.gz
WIP: open types support
Diffstat (limited to 'tests/test_rfc2315.py')
-rw-r--r--tests/test_rfc2315.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/tests/test_rfc2315.py b/tests/test_rfc2315.py
index b451ed1..ba92801 100644
--- a/tests/test_rfc2315.py
+++ b/tests/test_rfc2315.py
@@ -148,29 +148,15 @@ Kv0xuR3b3Le+ZqolT8wQELd5Mmw5JPofZ+O2cGNvet8tYwOKFjEA
assert asn1Object.prettyPrint()
assert der_encoder.encode(asn1Object) == substrate
- contentType = asn1Object['contentType']
- substrate = asn1Object['content']
+ def testDerCodecDecodeOpenTypes(self):
- contentInfoMap = {
- (1, 2, 840, 113549, 1, 7, 1): rfc2315.Data(),
- (1, 2, 840, 113549, 1, 7, 2): rfc2315.SignedData(),
- (1, 2, 840, 113549, 1, 7, 3): rfc2315.EnvelopedData(),
- (1, 2, 840, 113549, 1, 7, 4): rfc2315.SignedAndEnvelopedData(),
- (1, 2, 840, 113549, 1, 7, 5): rfc2315.DigestedData(),
- (1, 2, 840, 113549, 1, 7, 6): rfc2315.EncryptedData()
- }
-
- innerAsn1Object, rest = der_decoder.decode(
- substrate, asn1Spec=contentInfoMap[contentType]
- )
-
- asn1Object['content'] = der_encoder.encode(innerAsn1Object)
+ substrate = pem.readBase64fromText(self.pem_text_unordered)
- substrate = pem.readBase64fromText(self.pem_text_reordered)
+ asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True)
assert not rest
assert asn1Object.prettyPrint()
- assert der_encoder.encode(asn1Object) == substrate
+ assert der_encoder.encode(asn1Object, decodeOpenTypes=True) == substrate
suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])