
    M/eM                        d Z ddlZddlZddlmZ ddlZddlmZ ddlZddlZ	ddl
Z
ddlmZ ddlmZ  ej                  d      Z ej"                  d      Z ej&                  d	      Z G d
 dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z G d dej*                        Z  G d  d!ej*                        Z! G d" d#ej*                        Z" G d$ d%ej*                        Z# G d& d'ej*                        Z$ G d( d)ej*                        Z% G d* d+ej*                        Z&e'd,k(  r4 ejP                   e
jR                  ejT                  d-d e+gz                yy).zTests for acme.messages.    N)Dict)mock)
challenges)	test_utilzcert.derzcsr.derzrsa512_key.pemc                   X    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zy)	ErrorTestzTests for acme.messages.Error.c                 h   ddl m} ddl m} ddl m} ddl m} |j                  ddd	      | _        dd
|dz   d| _         |dd      | _         ||d      | _	        |j                  ddd| j                        | _
        |j                  ddd| j                  g      | _         |       | _        y )Nr   Error)ERROR_PREFIX
IdentifierIDENTIFIER_FQDN	malformedfootitledetailr   z
some title)r   r   typecustombar)typr   example.comr   valuecaa)r   r   
identifier)r   r   subproblems)acme.messagesr   r   r   r   	with_codeerrorjobjerror_customr   
subproblemerror_with_subproblemsempty_error)selfr   r   r   r   s        D/usr/lib/python3/dist-packages/acme/_internal/tests/messages_test.pysetUpzErrorTest.setUp   s    '.,1__[g_N
! ;.
	
 "hu=$N//%WY]YhYh/i&+ook%W^mqm|m|l}o&~# 7    c                 <    ddl m}  |       j                  dk(  sJ y )Nr   r
   zabout:blank)r    r   r   r(   r   s     r)   test_default_typzErrorTest.test_default_typ(   s    'w{{m+++r+   c                 F    ddl m}  |       |j                  d      k(  sJ y )Nr   r
   {})r    r   	from_jsonr-   s     r)   test_from_json_emptyzErrorTest.test_from_json_empty,   s    'w%//$////r+   c                 t    ddl m} t        |j                  | j                  j                                      y )Nr   r
   )r    r   hashr1   r"   to_jsonr-   s     r)   test_from_json_hashablez!ErrorTest.test_from_json_hashable0   s#    'U__TZZ//123r+   c                     ddl m} |j                  | j                  j	                               }dt        |j                        k(  sJ | j                  |j                  d   k(  sJ y )Nr   r
      )r    r   r1   r&   r5   lenr   r%   )r(   r   parsed_errors      r)   test_from_json_with_subproblemsz)ErrorTest.test_from_json_with_subproblems4   sX    't'B'B'J'J'LMC001111,":":1"====r+   c                 j    d| j                   j                  k(  sJ | j                  j                  J y )Nz!The request message was malformed)r"   descriptionr$   r(   s    r)   test_descriptionzErrorTest.test_description<   s2    2djj6L6LLLL  ,,444r+   c                     ddl m} d| j                  j                  k(  sJ | j                  j                  J  |       j                  J y )Nr   r
   r   )r    r   r"   coder$   r-   s     r)   	test_codezErrorTest.test_code@   sE    'djjoo---  %%---w||###r+   c                     ddl m} ddl m}  || j                        sJ  || j                        rJ  | |             rJ  || j
                        rJ  |d      rJ y )Nr   r
   is_acme_errorzmust pet all the {dogs|rabbits})r    r   rE   r"   r$   r'   r(   r   rE   s      r)   test_is_acme_errorzErrorTest.test_is_acme_errorF   sd    '/TZZ((( !2!2333 ))) !1!1222 !BCCCCr+   c                 X    ddl m} ddl m} |j                  ddd      } ||      sJ y )Nr   r
   rD   r   u
   عدالةr   r   )r    r   rE   r!   )r(   r   rE   arabic_errors       r)   test_unicode_errorzErrorTest.test_unicode_errorO   s2    '/ A ' R\***r+   c                     ddl m} ddl m}  ||j                  d            sJ t	        j
                  t              5  |j                  d       d d d        y # 1 sw Y   y xY w)Nr   r
   rD   badCSRznot an ACME error code)r    r   rE   r!   pytestraises
ValueErrorrF   s      r)   test_with_codezErrorTest.test_with_codeV   sM    '/U__X6777]]:& 	6OO45	6 	6 	6s   AA#c                     t        | j                        dj                  | j                        k(  sJ t        | j                        dj                  | j                  | j                        k(  sJ y )Nz5{0.typ} :: {0.description} :: {0.detail} :: {0.title}z{0.typ} :: {0.description} :: {0.detail} :: {0.title}
Problem for {1.identifier.value}: {1.typ} :: {1.description} :: {1.detail} :: {1.title})strr"   formatr&   r%   r>   s    r)   test_strzErrorTest.test_str]   sm    4::DVDJJ  	    4../ghnhn##T__i66 	6 6r+   c                     | j                   j                  J 	 ddz   | j                   j                  J y # t        $ r%}|j                  | j                   _        Y d }~Bd }~ww xY w)Nr8   r   )r$   __traceback__ZeroDivisionError)r(   es     r)   test_setting_tracebackz ErrorTest.test_setting_tracebackh   sg      ..666	>aC   ..::: ! 	>./ooD++	>s   8 	A&A!!A&N)__name__
__module____qualname____doc__r*   r.   r2   r6   r;   r?   rB   rG   rJ   rP   rT   rY    r+   r)   r   r      sB    (#",04>5$D+66;r+   r   c                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	ConstantTestz"Tests for acme.messages._Constant.c                 h    ddl m}  G d d|      }|| _         |d      | _         |d      | _        y )Nr   )	_Constantc                       e Zd ZU i Zeed<   y)(ConstantTest.setUp.<locals>.MockConstantPOSSIBLE_NAMESN)rZ   r[   r\   re   r   __annotations__r^   r+   r)   MockConstantrd   y   s    #%ND%r+   rg   ab)r    rb   rg   const_aconst_b)r(   rb   rg   s      r)   r*   zConstantTest.setUpv   s3    +	&9 	& )#C(#C(r+   c                     d| j                   j                         k(  sJ d| j                  j                         k(  sJ y )Nrh   ri   )rj   to_partial_jsonrk   r>   s    r)   test_to_partial_jsonz!ConstantTest.test_to_partial_json   s8    dll224444dll224444r+   c                     | j                   | j                  j                  d      k(  sJ t        j                  t
        j                        5  | j                  j                  d       d d d        y # 1 sw Y   y xY w)Nrh   c)rj   rg   r1   rM   rN   joseDeserializationErrorr>   s    r)   test_from_jsonzConstantTest.test_from_json   s`    ||t00::3????]]4445 	-'',	- 	- 	-s   A33A<c                 L    t        | j                  j                  d             y Nrh   )r4   rg   r1   r>   s    r)   r6   z$ConstantTest.test_from_json_hashable   s    T((-.r+   c                 l    dt        | j                        k(  sJ dt        | j                        k(  sJ y )NzMockConstant(a)zMockConstant(b))reprrj   rk   r>   s    r)   	test_reprzConstantTest.test_repr   s0     D$6666 D$6666r+   c                     | j                  d      }| j                  | j                  k7  sJ | j                  |k(  sJ | j                  | j                  k7  sJ | j                  |k(  sJ y ru   )rg   rj   rk   )r(   const_a_primes     r)   test_equalityzConstantTest.test_equality   sb    ))#.||t||+++||},,,||t||+++||},,,r+   N)
rZ   r[   r\   r]   r*   rn   rs   r6   rx   r{   r^   r+   r)   r`   r`   s   s#    ,)5-
/7-r+   r`   c                   F    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)DirectoryTestz"Tests for acme.messages.Directory.c           	      X    ddl m}  |dd|j                  dddg      d	      | _        y )
Nr   	Directoryregcerthttps://example.com/acme/termshttps://www.example.com/r   )terms_of_servicewebsitecaa_identitiesnewRegnewCertmeta)r    r   Metadirr(   r   s     r)   r*   zDirectoryTest.setUp   s8    +NN!A2 - # 
 r+   c                 $    ddl m}  |ddi       y Nr   r   r   r   )r    r   r   s     r)   !test_init_wrong_key_value_successz/DirectoryTest.test_init_wrong_key_value_success   s    +5%.!r+   c                 ,    d| j                   d   k(  sJ y )Nr   r   )r   r>   s    r)   test_getitemzDirectoryTest.test_getitem   s    ****r+   c                     t        j                  t              5  | j                  j	                  d       d d d        y # 1 sw Y   y xY wNr   )rM   rN   KeyErrorr   __getitem__r>   s    r)   !test_getitem_fails_with_key_errorz/DirectoryTest.test_getitem_fails_with_key_error   s5    ]]8$ 	(HH  '	( 	( 	(	   ?Ac                 :    d| j                   j                  k(  sJ y )Nr   )r   r   r>   s    r)   test_getattrzDirectoryTest.test_getattr   s    '''r+   c                     t        j                  t              5  | j                  j	                  d       d d d        y # 1 sw Y   y xY wr   )rM   rN   AttributeErrorr   __getattr__r>   s    r)   'test_getattr_fails_with_attribute_errorz5DirectoryTest.test_getattr_fails_with_attribute_error   s5    ]]>* 	(HH  '	( 	( 	(r   c                 T    | j                   j                         dddddgddk(  sJ y )Nr   r   r   r   r   )termsOfServicer   caaIdentitiesr   )r   r5   r>   s    r)   test_to_jsonzDirectoryTest.test_to_json   s<    xx!"B5"/&
 
 	
 
r+   c                 6    ddl m} |j                  ddi       y r   )r    r   r1   r   s     r)   2test_from_json_deserialization_unknown_key_successz@DirectoryTest.test_from_json_deserialization_unknown_key_success   s    +UEN+r+   c                     d}| j                   j                  D ]$  }|dk(  s	| j                   j                  |   dk(  }& |sJ y )NFr   r   )r   r   )r(   resultks      r)   test_iter_metazDirectoryTest.test_iter_meta   sJ     	NA&&q)-MM	N vr+   N)rZ   r[   r\   r]   r*   r   r   r   r   r   r   r   r   r^   r+   r)   r}   r}      s2    ,
"+(((	
,r+   r}   c                       e Zd Zd Zd Zy)ExternalAccountBindingTestc                     ddl m} t        j                  j	                  t
        j                               | _        d| _        d| _	         |ddi      | _
        y )Nr   r   keykid-for-testinghmac-key-for-testing
newAccounthttp://url/acme/new-account)r    r   rq   jwkJWKRSAKEY
public_keyr   kidhmac_keyr   r   s     r)   r*   z ExternalAccountBindingTest.setUp   sG    +88??s~~'7?8$.7
 r+   c                     ddl m} |j                  | j                  | j                  | j
                  | j                        }t        |      dk(  sJ t        |j                               t        g d      k(  sJ y )Nr   ExternalAccountBinding   	protectedpayload	signature)
r    r   	from_datar   r   r   r   r9   sortedkeys)r(   r   eabs      r)   test_from_dataz)ExternalAccountBindingTest.test_from_data   s]    8$..txx4==RVRZRZ[3x1}}chhj!V,Q%RRRRr+   N)rZ   r[   r\   r*   r   r^   r+   r)   r   r      s    Sr+   r   c                   F    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)RegistrationTestz%Tests for acme.messages.Registration.c                 B   t         j                  j                  t        j	                               }d}d}ddlm}  ||||      | _         |       | _        |||d| _	        | j                  j                         | _        |j                         | j                  d<   y )	Nr   )mailto:admin@foo.comtel:1234zhttps://letsencrypt.org/termsr   Registration)r   contact	agreement)r   r   r   r   )rq   r   r   r   r   r    r   r   reg_nonejobj_tocopy	jobj_fromr5   )r(   r   r   r   r   s        r)   r*   zRegistrationTest.setUp   s    hhoo#.."2o3
 4	.CIN$ "

 **, #ur+   c                 X    ddl m} |j                  dd      }|j                  dk(  sJ y )Nr   r   1234admin@foo.com)phoneemail)r   r   )r    r   r   r   )r(   r   r   s      r)   r   zRegistrationTest.test_from_data   s5    .$$6$I{{ 
 
 	
 
r+   c                 ~   ddl m} ddl m} ddl m} t        j
                  j                  t        j                               }d}d} |dd	i      }|j                  ||||      }|j                  d
|      }	|	j                  dk(  sJ t        |	j                  j                               t        g d      k(  sJ y )Nr   r   r   NewRegistrationr   r   r   r   r   r   )r   external_account_binding)r   r   )r    r   r   r   rq   r   r   r   r   r   r   r   r   r   )
r(   r   r   r   r   r   r   	directoryr   r   s
             r)   (test_new_registration_from_data_with_eabz9RegistrationTest.test_new_registration_from_data_with_eab  s    +81hhoo#.."2o3)7
 	 %..sC9M''oX['\{{ 
 
 	
 
 c22779: EFG 	G Gr+   c                 :    d| j                   j                  k(  sJ y )N)r   )r   phonesr>   s    r)   test_phoneszRegistrationTest.test_phones  s    DHHOO+++r+   c                 :    d| j                   j                  k(  sJ y )N)r   )r   emailsr>   s    r)   test_emailszRegistrationTest.test_emails  s    !TXX__444r+   c                 V    | j                   | j                  j                         k(  sJ y N)r   r   rm   r>   s    r)   rn   z%RegistrationTest.test_to_partial_json  s!    ||txx779999r+   c                 d    ddl m} | j                  |j                  | j                        k(  sJ y Nr   r   )r    r   r   r1   r   r(   r   s     r)   rs   zRegistrationTest.test_from_json  s&    .xx<11$..AAAAr+   c                 X    ddl m} t        |j                  | j                               y r   )r    r   r4   r1   r   r   s     r)   r6   z(RegistrationTest.test_from_json_hashable!  s    .\##DNN34r+   c                    ddl m}  |       } |d      }|j                  dk(  sJ |j                  dk(  sJ d|j                         vsJ d|j	                         vsJ d|j                         v sJ d|j	                         v sJ y )Nr   r   r^   )r   r   )r    r   r   rm   fields_to_partial_json)r(   r   empty_new_regnew_reg_with_contacts       r)   test_default_not_transmittedz-RegistrationTest.test_default_not_transmitted%  s    1').r:$$***#++r111 = = ???? D D FFFF0@@BBBB0GGIIIIr+   N)rZ   r[   r\   r]   r*   r   r   r   r   rn   rs   r6   r   r^   r+   r)   r   r      s5    /.(
G$,5:B5Jr+   r   c                       e Zd ZdZd Zy)UpdateRegistrationTestz+Tests for acme.messages.UpdateRegistration.c                 ~    ddl m} d}d |       j                         k(  sJ  |       |j                  |      k(  sJ y )Nr   )UpdateRegistrationz{"resource": "reg"}r0   )r    r   
json_dumps
json_loads)r(   r   jstrings      r)   
test_emptyz!UpdateRegistrationTest.test_empty6  sB    4')+668888!#'9'D'DW'MMMMr+   N)rZ   r[   r\   r]   r   r^   r+   r)   r   r   3  s    5Nr+   r   c                       e Zd ZdZd Zd Zy)RegistrationResourceTestz-Tests for acme.messages.RegistrationResource.c                     ddl m}  |t        j                  j                  t        j                  j
                  t        j                  j                        | _        y )Nr   )RegistrationResourcebodyurir   )r    r   r   sentinelr   r   r   regr)r(   r   s     r)   r*   zRegistrationResourceTest.setUp@  s7    6(##):):!]];;=	r+   c                     | j                   j                         t        j                  j                  t        j                  j
                  t        j                  j                  dk(  sJ y )Nr   )r   r5   r   r   r   r   r   r>   s    r)   rn   z-RegistrationResourceTest.test_to_partial_jsonF  sM    yy  "MM&&==$$ $ > >'
 
 	
 
r+   NrZ   r[   r\   r]   r*   rn   r^   r+   r)   r   r   =  s    7=
r+   r   c                       e Zd ZdZd Zy)ChallengeResourceTestz*Tests for acme.messages.ChallengeResource.c                 j    ddl m} d |t        j                  d      d      j                  k(  sJ y )Nr   )ChallengeResourcehttp://challbr   zhttp://authz)r   
authzr_uri)r    r  r   	MagicMockr   )r(   r  s     r)   test_urizChallengeResourceTest.test_uriQ  s8    3"3:!-;#==@SA 	A Ar+   N)rZ   r[   r\   r]   r
  r^   r+   r)   r  r  N  s    4Ar+   r  c                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	ChallengeBodyTestz&Tests for acme.messages.ChallengeBody.c                    t        j                  t        j                  d            | _        ddlm} ddlm} ddlm} || _	        |j                  dd	      } |d
| j                  | j                  |      | _        d
| j                  dd|d| _        | j                  j                         | _        d| j                  d<   ddd| j                  d<   y )N+evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oAtokenr   ChallengeBodyr
   )STATUS_INVALIDserverInternalz%Unable to communicate with DNS server)r   r  )r   challstatusr"   dns)urlr  r   r  r"   invalidr  z)urn:ietf:params:acme:error:serverInternal)r   r   r"   )r   DNSrq   	b64decoder  r    r  r   r  r  r!   challbr   r   r   )r(   r  r   r  r"   s        r)   r*   zChallengeBodyTest.setUpZ  s    ^^$..9+; <
 	0'0$ 09`a#tzz$++
 #kkB
 **,#,x ?=#
wr+   c                 l    | j                   j                  d      | j                   j                  k(  sJ y )Nr   )r  encoder   r>   s    r)   test_encodezChallengeBodyTest.test_encodeu  s'    {{!!%(DKKOO;;;r+   c                 V    | j                   | j                  j                         k(  sJ y r   )r   r  rm   r>   s    r)   rn   z&ChallengeBodyTest.test_to_partial_jsonx  s!    ||t{{::<<<<r+   c                 d    ddl m} | j                  |j                  | j                        k(  sJ y Nr   r  )r    r  r  r1   r   r(   r  s     r)   rs   z ChallengeBodyTest.test_from_json{  s&    /{{m55dnnEEEEr+   c                 X    ddl m} t        |j                  | j                               y r"  )r    r  r4   r1   r   r#  s     r)   r6   z)ChallengeBodyTest.test_from_json_hashable      /]$$T^^45r+   c                 `    t        j                  d      | j                  j                  k(  sJ y )Nr  )rq   r  r  r  r>   s    r)   
test_proxyzChallengeBodyTest.test_proxy  s0    ~~9;>Bkk>O>OP 	P Pr+   N)
rZ   r[   r\   r]   r*   r  rn   rs   r6   r'  r^   r+   r)   r  r  W  s%    0
6<=F6Pr+   r  c                   "    e Zd ZdZd Zd Zd Zy)AuthorizationTestz&Tests for acme.messages.Authorization.c                    ddl m} ddl m}  |d|t        j                  d             |d|t        j
                  d	            f| _        dd
l m} ddl m} ddl m	}  ||d      } ||| j                        | _
        |j                         | j                  D cg c]  }|j                          c}d| _        y c c}w )Nr   r  )STATUS_VALIDhttp://challb1   IlirfxKKXAsHtmzK29Pj8Ar  r   r  r  http://challb2   DGyRejmCefe7v4NfDGDKfAAuthorizationr   r   r   r   r   r   )r    r  r+  r   HTTP01r  challbsr2  r   r   authzr5   r   )r(   r  r+  r2  r   r   r   r  s           r)   r*   zAuthorizationTest.setUp  s    /. $\ ''.GHJ .| *$=!?@	
 	0,1O=I
"!dll<
 %,,.:>,,G6>>+G
Gs   "Cc                 F    ddl m} |j                  | j                         y Nr   r1  )r    r2  r1   r   r(   r2  s     r)   rs   z AuthorizationTest.test_from_json  s    //r+   c                 X    ddl m} t        |j                  | j                               y r8  )r    r2  r4   r1   r   r9  s     r)   r6   z)AuthorizationTest.test_from_json_hashable  r%  r+   N)rZ   r[   r\   r]   r*   rs   r6   r^   r+   r)   r)  r)    s    0
206r+   r)  c                       e Zd ZdZd Zy)AuthorizationResourceTestz.Tests for acme.messages.AuthorizationResource.c                     ddl m}  |t        j                  j                  t        j                  j
                        }t        |t        j                        sJ y )Nr   AuthorizationResourcer   r   )	r    r?  r   r   r   r   
isinstancerq   JSONDeSerializable)r(   r?  authzrs      r)   test_json_de_serializablez3AuthorizationResourceTest.test_json_de_serializable  sA    7&!!##% &$"9"9:::r+   N)rZ   r[   r\   r]   rD  r^   r+   r)   r<  r<    s
    8;r+   r<  c                       e Zd ZdZd Zd Zy)CertificateRequestTestz+Tests for acme.messages.CertificateRequest.c                 4    ddl m}  |t              | _        y )Nr   CertificateRequest)csr)r    rI  CSRreqr(   rI  s     r)   r*   zCertificateRequestTest.setUp  s    4%#.r+   c                     t        | j                  t        j                        sJ ddlm} | j                  |j                  | j                  j                               k(  sJ y )Nr   rH  )rA  rL  rq   rB  r    rI  r1   r5   rM  s     r)   rD  z0CertificateRequestTest.test_json_de_serializable  sJ    $((D$;$;<<<4xx-778H8H8JKKKKr+   NrZ   r[   r\   r]   r*   rD  r^   r+   r)   rF  rF    s    5/Lr+   rF  c                       e Zd ZdZd Zd Zy)CertificateResourceTestz0Tests for acme.messages.CertificateResourceTest.c                     ddl m}  |t        t        j                  j
                  dt        j                  j                        | _        y )Nr   CertificateResourcer^   )r   r   authzrscert_chain_uri)r    rT  CERTr   r   r   rV  certrr(   rT  s     r)   r*   zCertificateResourceTest.setUp  s/    5(4==,,b==779
r+   c                     t        | j                  t        j                        sJ ddlm} | j                  |j                  | j                  j                               k(  sJ y )Nr   rS  )rA  rX  rq   rB  r    rT  r1   r5   rY  s     r)   rD  z1CertificateResourceTest.test_json_de_serializable  sJ    $**d&=&=>>>5zz0::4::;M;M;OPPPPr+   NrO  r^   r+   r)   rQ  rQ    s    :9Qr+   rQ  c                       e Zd ZdZd Zd Zy)RevocationTestz'Tests for acme.messages.RevocationTest.c                 4    ddl m}  |t              | _        y )Nr   
Revocation)certificate)r    r_  rW  revr(   r_  s     r)   r*   zRevocationTest.setUp  s    ,$/r+   c                 t    ddl m} t        |j                  | j                  j                                      y )Nr   r^  )r    r_  r4   r1   ra  r5   rb  s     r)   r6   z&RevocationTest.test_from_json_hashable  s%    ,Z!!$(("2"2"456r+   N)rZ   r[   r\   r]   r*   r6   r^   r+   r)   r\  r\    s    107r+   r\  c                   "    e Zd ZdZd Zd Zd Zy)OrderResourceTestz&Tests for acme.messages.OrderResource.c                     ddl m}  |t        j                  j                  t        j                  j
                        | _        y )Nr   OrderResource)r   r   )r    rh  r   r   r   r   r   )r(   rh  s     r)   r*   zOrderResourceTest.setUp  s*    /!##):):<	r+   c                     | j                   j                         t        j                  j                  t        j                  j
                  d dk(  sJ y )N)r   r   authorizations)r   r5   r   r   r   r   r>   s    r)   rn   z&OrderResourceTest.test_to_partial_json  sC    yy  "MM&&==$$"'
 
 	
 
r+   c                    ddl m} ddl m}  |d|t        j                  d             |d|t        j
                  d	            f}dd
l m} ddl m} ddl m} ddl m	}  ||d      } |d |||            }	ddl m
}
  |
|f|t        d |D                    }ddl m}  |d|d|	f      }| j                  ||j                  |j                                      y )Nr   r  )STATUS_PENDINGr,  r-  r  r.  r/  r0  r1  r>  r   r   r   r   zhttp://authz1r3  r@  )Orderc              3   4   K   | ]  }|j                     y wr   r  ).0r  s     r)   	<genexpr>z>OrderResourceTest.test_json_de_serializable.<locals>.<genexpr>  s     )K&**)Ks   )identifiersr  rj  rg  zhttp://order1s	   test blob)r   r   csr_pemrj  )r    r  rl  r   r4  r  r2  r?  r   r   rm  tuplerh  assertEqualr1   r5   )r(   r  rl  r5  r2  r?  r   r   r   r6  rm  r   rh  orderrs                 r)   rD  z+OrderResourceTest.test_json_de_serializable  s    /0$^ ''.GHJ .~ *$=!?@	
 	07,1O=I
%/+85?5<,>? 	(*~$))K7)K$KM/?'3/4h8 	&001AB	Dr+   N)rZ   r[   r\   r]   r*   rn   rD  r^   r+   r)   re  re    s    0<

Dr+   re  c                       e Zd ZdZd Zd Zy)NewOrderTestz!Tests for acme.messages.NewOrder.c                 \    ddl m}  |t        j                  j                        | _        y )Nr   )NewOrder)rq  )r    ry  r   r   rq  r   )r(   ry  s     r)   r*   zNewOrderTest.setUp  s    *113r+   c                 v    | j                   j                         dt        j                  j                  ik(  sJ y )Nrq  )r   r5   r   r   rq  r>   s    r)   rn   z!NewOrderTest.test_to_partial_json  s5    xx!4==44&
 
 	
 
r+   Nr  r^   r+   r)   rw  rw    s    +3

r+   rw  c                       e Zd ZdZd Zy)JWSPayloadRFC8555CompliantzFTest for RFC8555 compliance of JWS generated from resources/challengesc                 l    ddl m}  |       }|j                  d      j                         }|dk(  sJ y )Nr   )NewAuthorization   )indents   {})r    r~  r   r  )r(   r~  	new_orderr#   s       r)   test_message_payloadz/JWSPayloadRFC8555Compliant.test_message_payload  s5    2$&	##1#-446u}}r+   N)rZ   r[   r\   r]   r  r^   r+   r)   r|  r|    s
    Pr+   r|  __main__r8   ),r]   
contextlibsystypingr   unittestr   warningsjosepyrq   rM   acmer   acme._internal.testsr   load_comparable_certrW  load_comparable_csrrK  load_rsa_private_keyr   TestCaser   r`   r}   r   r   r   r   r  r  r)  r<  rF  rQ  r\  re  rw  r|  rZ   exitmainargv__file__r^   r+   r)   <module>r     s     
        *%y%%j1#i##I.$i$$%56\;!! \;~#-8$$ #-L5H%% 5pS!2!2 S$MJx(( MJ`NX.. N
x00 
"AH-- A.P)) .Pb"6)) "6J; 1 1 ;
LX.. 
LQh// Q	7X&& 	7,D)) ,D\
8$$ 
	!2!2 	 zCHH[V[[!"
234 r+   