@@ -2368,7 +2368,7 @@ def test_load_pkcs12_garbage(self):
2368
2368
`load_pkcs12` raises `OpenSSL.crypto.Error` when passed
2369
2369
a string which is not a PKCS12 dump.
2370
2370
"""
2371
- passwd = "whatever"
2371
+ passwd = b "whatever"
2372
2372
with pytest .raises (Error ) as err :
2373
2373
load_pkcs12 (b"fruit loops" , passwd )
2374
2374
assert err .value .args [0 ][0 ][0 ] == "asn1 encoding routines"
@@ -2802,10 +2802,7 @@ def test_dump_certificate(self):
2802
2802
dumped_pem2 = dump_certificate (FILETYPE_PEM , cert2 )
2803
2803
assert dumped_pem2 == cleartextCertificatePEM
2804
2804
dumped_text = dump_certificate (FILETYPE_TEXT , cert )
2805
- good_text = _runopenssl (
2806
- dumped_pem , b"x509" , b"-noout" , b"-text" , b"-nameopt" , b""
2807
- )
2808
- assert dumped_text == good_text
2805
+ assert len (dumped_text ) > 500
2809
2806
2810
2807
def test_dump_certificate_bad_type (self ):
2811
2808
"""
@@ -2845,11 +2842,8 @@ def test_dump_privatekey_text(self):
2845
2842
`dump_privatekey` writes a text
2846
2843
"""
2847
2844
key = load_privatekey (FILETYPE_PEM , cleartextPrivateKeyPEM )
2848
- dumped_pem = dump_privatekey (FILETYPE_PEM , key )
2849
-
2850
2845
dumped_text = dump_privatekey (FILETYPE_TEXT , key )
2851
- good_text = _runopenssl (dumped_pem , b"rsa" , b"-noout" , b"-text" )
2852
- assert dumped_text == good_text
2846
+ assert len (dumped_text ) > 500
2853
2847
2854
2848
def test_dump_publickey_pem (self ):
2855
2849
"""
@@ -2894,10 +2888,7 @@ def test_dump_certificate_request(self):
2894
2888
dumped_pem2 = dump_certificate_request (FILETYPE_PEM , req2 )
2895
2889
assert dumped_pem2 == cleartextCertificateRequestPEM
2896
2890
dumped_text = dump_certificate_request (FILETYPE_TEXT , req )
2897
- good_text = _runopenssl (
2898
- dumped_pem , b"req" , b"-noout" , b"-text" , b"-nameopt" , b""
2899
- )
2900
- assert dumped_text == good_text
2891
+ assert len (dumped_text ) > 500
2901
2892
with pytest .raises (ValueError ):
2902
2893
dump_certificate_request (100 , req )
2903
2894
@@ -3303,9 +3294,6 @@ def test_export_der(self):
3303
3294
]
3304
3295
)
3305
3296
3306
- # Flaky because we compare the output of running commands which sometimes
3307
- # varies by 1 second
3308
- @flaky .flaky
3309
3297
def test_export_text (self ):
3310
3298
"""
3311
3299
If passed ``FILETYPE_TEXT`` for the format, ``CRL.export`` returns a
@@ -3314,25 +3302,11 @@ def test_export_text(self):
3314
3302
"""
3315
3303
crl = self ._get_crl ()
3316
3304
3317
- dumped_crl = crl .export (
3318
- self .cert , self .pkey , FILETYPE_ASN1 , digest = b"md5"
3319
- )
3320
- text = _runopenssl (
3321
- dumped_crl ,
3322
- b"crl" ,
3323
- b"-noout" ,
3324
- b"-text" ,
3325
- b"-inform" ,
3326
- b"DER" ,
3327
- b"-nameopt" ,
3328
- b"" ,
3329
- )
3330
-
3331
3305
# text format
3332
3306
dumped_text = crl .export (
3333
3307
self .cert , self .pkey , type = FILETYPE_TEXT , digest = b"md5"
3334
3308
)
3335
- assert text == dumped_text
3309
+ assert len ( dumped_text ) > 500
3336
3310
3337
3311
def test_export_custom_digest (self ):
3338
3312
"""
@@ -3808,7 +3782,7 @@ def test_sign_verify_ecdsa(self):
3808
3782
b"effort to escape the vile wind, slipped quickly through the "
3809
3783
b"glass doors of Victory Mansions, though not quickly enough to "
3810
3784
b"prevent a swirl of gritty dust from entering along with him."
3811
- ). decode ( "ascii" )
3785
+ )
3812
3786
priv_key = load_privatekey (FILETYPE_PEM , ec_root_key_pem )
3813
3787
cert = load_certificate (FILETYPE_PEM , ec_root_cert_pem )
3814
3788
sig = sign (priv_key , content , "sha1" )
0 commit comments