Skip to content

Commit cada75a

Browse files
committed
Fix test_rfc2986 issues
1 parent 9c05c76 commit cada75a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Revision 0.2.6, released XX-05-2019
2+
Revision 0.2.6, released XX-07-2019
33
-----------------------------------
44

55
- Added RFC3560 providing RSAES-OAEP Key Transport Algorithm

tests/test_rfc2986.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pyasn1.codec.der import encoder as der_encoder
1111

1212
from pyasn1.type import char
13+
from pyasn1.type import univ
1314

1415
from pyasn1_modules import pem
1516
from pyasn1_modules import rfc2986
@@ -56,10 +57,16 @@ def testDerCodec(self):
5657

5758
def testOpenTypes(self):
5859

60+
id_at_commonName = (2, 5, 4, 3)
61+
id_at_countryName = (2, 5, 4, 6)
62+
5963
substrate = pem.readBase64fromText(self.pem_text)
6064

6165
rfc2986.certificateAttributesMap.update(
62-
rfc5280.certificateAttributesMap)
66+
{
67+
id_at_countryName: char.PrintableString()
68+
}
69+
)
6370

6471
asn1Object, rest = der_decoder.decode(substrate,
6572
asn1Spec=rfc2986.CertificationRequest(),
@@ -70,10 +77,11 @@ def testOpenTypes(self):
7077
assert der_encoder.encode(asn1Object) == substrate
7178

7279
for rdn in asn1Object['certificationRequestInfo']['subject']['rdnSequence']:
73-
if rdn[0]['type'] == rfc2986.id_at_countryName:
80+
if rdn[0]['type'] == id_at_countryName:
7481
assert rdn[0]['value'] == char.PrintableString('US')
75-
else:
76-
assert len(rdn[0]['value']['utf8String']) > 2
82+
elif rdn[0]['type'] == id_at_commonName:
83+
assert rdn[0]['value'] == univ.OctetString(
84+
hexValue='0c146663752e66616b652e616464726573732e6f7267')
7785

7886

7987
suite = unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])

0 commit comments

Comments
 (0)