+
    Dfj	-                     :   R t ^ RIHt ^ RIHt ^ RIHt RtRtRt	Rt
 ! R R	]P                  4      t ! R
 R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      tR# )z4
Tests for L{twisted.words.protocols.jabber.error}.
)unittesterror)domishz$http://www.w3.org/XML/1998/namespace http://etherx.jabber.org/streamsz#urn:ietf:params:xml:ns:xmpp-streamsz#urn:ietf:params:xml:ns:xmpp-stanzasc                   h   a  ] tR t^t o V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )BaseErrorTestsc                   < V ^8  d   QhRR/#    returnN )format__classdict__s   "E/usr/lib/python3/dist-packages/twisted/words/test/test_jabbererror.py__annotate__BaseErrorTests.__annotate__   s     3 3d 3    c                    \         P                  ! R4      pVP                  4       pV P                  VP                  R4       V P                  \        VP                  4      ^4       R# )z,
Test getting an element for a plain error.
feature-not-implementedN)r   	BaseError
getElementassertIdenticaluriassertEquallenchildrenselfeelements   &  r   test_getElementPlain#BaseErrorTests.test_getElementPlain   sM     OO56,,.W[[$/W--.2r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     L LT Lr   c                J   \         P                  ! RR4      pVP                  4       pV P                  \	        VP
                  4      ^4       V P                  \        VP                  4      R4       V P                  VP                  P                  \        R34      R4       R# )z3
Test getting an element for an error with a text.
r   textlangN)
r   r   r   r   r   r   strr%   getAttributeNS_XMLr   s   &  r   test_getElementText"BaseErrorTests.test_getElementText   sx     OO5v>,,.W--.2W\\*F322FF3CDdKr   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r   '   s     B B Br   c                <   \         P                  ! RRR4      pVP                  4       pV P                  \	        VP
                  4      ^4       V P                  \        VP                  4      R4       V P                  VP                  \        R3,          R4       R# )z@
Test getting an element for an error with a text and language.
r   r%   en_USr&   N)	r   r   r   r   r   r   r'   r%   r)   r   s   &  r   test_getElementTextLang&BaseErrorTests.test_getElementTextLang'   st     OO5vwG,,.W--.2W\\*F3vv&67Ar   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r   1   s     . .T .r   c                   \         P                  ! R4      p\        P                  ! RVR7      pVP	                  4       pV P                  \        VP                  4      ^4       V P                  VP                  V4       R# )zF
Test getting an element for an error with an app specific condition.
r   )appConditionN)testnsmyerror)	r   Elementr   r   r   r   r   r   r5   )r   acr   r    s   &   r   test_getElementAppCondition*BaseErrorTests.test_getElementAppCondition1   s^     ^^12OO5BG,,.W--.2"-r   r   N)
__name__
__module____qualname____firstlineno__r!   r*   r/   r8   __static_attributes____classdictcell__r   s   @r   r   r      s1     3 3L LB B. .r   r   c                   V   a  ] tR t^<t o V 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )	StreamErrorTestsc                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   StreamErrorTests.__annotate__=   s     2 2d 2r   c                    \         P                  ! R4      pVP                  4       pV P                  VP                  \
        4       R# )z;
Test namespace of the element representation of an error.
r   N)r   StreamErrorr   r   r   
NS_STREAMSr   s   &  r   r!   %StreamErrorTests.test_getElementPlain=   s4     78,,.j1r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   rD   E        
 
4 
r   c                    \         P                  ! R4      pVP                  4       pV P                  \        \        VR4      P                  4       R# zB
Test that the error condition element has the correct namespace.
r   N)r   rF   r   r   NS_XMPP_STREAMSgetattrr   r   s   &  r   !test_getElementConditionNamespace2StreamErrorTests.test_getElementConditionNamespaceE   A     78,,.WW.GHLL	
r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   rD   O        < <d <r   c                    \         P                  ! RR4      pVP                  4       pV P                  \        VP
                  P                  4       R# )=
Test that the error text element has the correct namespace.
r   r%   N)r   rF   r   r   rM   r%   r   r   s   &  r   test_getElementTextNamespace-StreamErrorTests.test_getElementTextNamespaceO   s<     7@,,.',,*:*:;r   r   N)	r:   r;   r<   r=   r!   rO   rV   r>   r?   r@   s   @r   rB   rB   <   s#     2 2
 
< <r   rB   c                      a  ] tR t^Xt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
RtV tR# )StanzaErrorTestsz!
Tests for L{error.StreamError}.
c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   StanzaErrorTests.__annotate__]   s     ( (d (r   c                    \         P                  ! R4      pV P                  RVP                  4       V P                  RVP                  4       R# )z9
Remote Server Timeout should yield type wait, code 504.
zremote-server-timeoutwait504N)r   StanzaErrorr   typecode)r   r   s   & r   test_typeRemoteServerTimeout-StanzaErrorTests.test_typeRemoteServerTimeout]   s=     56('r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r[   e   s     1 1d 1r   c                    \         P                  ! R4      pVP                  4       pV P                  VP                  R4       V P                  VR,          R4       V P                  VR,          R4       R# )z3
Test getting an element for a plain stanza error.
r   Nr`   cancelra   501r   r_   r   r   r   r   s   &  r   r!   %StanzaErrorTests.test_getElementPlaine   s\     78,,.d+(3%0r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r[   o   s     1 1T 1r   c                    \         P                  ! RR4      pVP                  4       pV P                  VP                  R4       V P                  VR,          R4       V P                  VR,          R4       R# )z?
Test getting an element for a stanza error with a given type.
r   authNr`   ra   rg   rh   r   s   &  r   test_getElementType$StanzaErrorTests.test_getElementTypeo   s^     7@,,.d+&1%0r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r[   y   rJ   r   c                    \         P                  ! R4      pVP                  4       pV P                  \        \        VR4      P                  4       R# rL   )r   r_   r   r   NS_XMPP_STANZASrN   r   r   s   &  r   rO   2StanzaErrorTests.test_getElementConditionNamespacey   rQ   r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r[      rS   r   c                    \         P                  ! RRR7      pVP                  4       pV P                  \        VP
                  P                  4       R# )rU   r   r%   )r%   N)r   r_   r   r   rq   r%   r   r   s   &  r   rV   -StanzaErrorTests.test_getElementTextNamespace   s<     7fE,,.',,*:*:;r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r[      s     @ @ @r   c                V   \         P                  ! R4      pRVR&   RVR&   RVR&   \        P                  ! R4      pVP	                  V4      pV P                  W14       V P                  VR,          R4       V P                  VR,          R4       V P                  VR,          R4       V P                  VP                  P                  ^ ,          P                  R4       V P                  VP                  R,          R	4       V P                  VP                  VP                  4       R
# )z
Test an error response is generated from a stanza.

The addressing on the (new) response stanza should be reversed, an
error child (with proper properties) added and the type set to
C{'error'}.
chatr`   zuser1@example.comtozuser2@example.com/resourcefromservice-unavailabler   rf   N)zjabber:clientmessage)
r   r6   r   r_   
toResponseassertNotIdenticalr   r   nameassertNotEqual)r   stanzar   responses   &   r   test_toResponse StanzaErrorTests.test_toResponse   s      <=v*t5v34<<'1&)+>?$)EF&)7300388:OP/:FOOX->->?r   r   N)r:   r;   r<   r=   __doc__rb   r!   rm   rO   rV   r   r>   r?   r@   s   @r   rY   rY   X   sH     ( (1 11 1
 
< <@ @r   rY   c                      a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltRtV tR# )ParseErrorTestsz!
Tests for L{error._parseError}.
c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   ParseErrorTests.__annotate__   s     5 5t 5r   c                <    \         P                  ! R4      V n        R # )N)Nr   )r   r6   r   )r   s   &r   setUpParseErrorTests.setUp   s    ^^O4
r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     
 
D 
r   c           
     |    \         P                  ! V P                   R4      pV P                  RRRRRRRR/V4       R# )z*
Test parsing of the empty error element.
errorns	conditionNr%   textLangr3   )r   _parseErrorr   r   results   & r   
test_emptyParseErrorTests.test_empty   s@     ""4::y9$j$PTU	
r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     = = =r   c                    V P                   P                  R4       \         P                  ! V P                   R4      pV P                  RVR,          4       R# )z4
Test parsing of an error element with a condition.
r   bad-requestr   N)r   r   r   
addElementr   r   r   s   & r   test_conditionParseErrorTests.test_condition   sB     	

89""4::y9{(;<r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     3 34 3r   c                   V P                   P                  R4      pVP                  R4       \         P                  ! V P                   R4      pV P	                  RVR,          4       V P	                  RVR,          4       R# )z/
Test parsing of an error element with a text.
r   r%   testNr   r   r%   )r   r   
addContentr   r   r   r%   r   s   &  r   	test_textParseErrorTests.test_text   sd     zz$$%89""4::y90vj12r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     6 6t 6r   c                    V P                   P                  R4      pRV\        R3&   VP                  R4       \         P                  ! V P                   R4      pV P                  RVR,          4       R# )zG
Test parsing of an error element with a text with a defined language.
r   r.   r&   r   r   Nr   )r   r   r)   r   r   r   r   s   &  r   test_textLangParseErrorTests.test_textLang   s^     zz$$%89&VV^""4::y9&"45r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     < <4 <r   c                    V P                   P                  R4      p\         P                  ! V P                   R4      pV P                  WR,          4       R# )zB
Test parsing of an error element with an app specific condition.
r   r3   Nr4   r   r   r   r   r   s   &  r   test_appCondition!ParseErrorTests.test_appCondition   sB     JJ))*AB	""4::y9>$:;r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r      s     < <4 <r   c                    V P                   P                  R4       V P                   P                  R4      p\         P                  ! V P                   R4      pV P                  WR,          4       R# )zI
Test parsing of an error element with multiple app specific conditions.
r   r3   Nr   )r4   
condition2r   r   s   &  r   test_appConditionMultiple)ParseErrorTests.test_appConditionMultiple   sU     	

56JJ))*BC	""4::y9>$:;r   r   N)r:   r;   r<   r=   r   r   r   r   r   r   r   r   r>   r?   r@   s   @r   r   r      sP     5 5
 
= =3 36 6< << <r   r   c                   D   a  ] tR t^t o V 3R lR ltV 3R lR ltRtV tR# )ExceptionFromStanzaTestsc                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   %ExceptionFromStanzaTests.__annotate__   s     &/ &/D &/r   c                H   \         P                  ! R	4      pVP                  R
4      pVP                  R4       VP                  R4      pRVR&   VP                  \        R34       VP                  R4      pRVR&   \        P
                  ! V4      pV P                  V\        P                  4       V P                  RVP                  4       V P                  RVP                  4       V P                  WEP                  4       V P                  V.VP                  4       R# )a]  
Test basic operations of exceptionFromStanza.

Given a realistic stanza, check if a sane exception is returned.

Using this stanza::

  <iq type='error'
      from='pubsub.shakespeare.lit'
      to='francisco@denmark.lit/barracks'
      id='subscriptions1'>
    <pubsub xmlns='http://jabber.org/protocol/pubsub'>
      <subscriptions/>
    </pubsub>
    <error type='cancel'>
      <feature-not-implemented
        xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
      <unsupported xmlns='http://jabber.org/protocol/pubsub#errors'
                   feature='retrieve-subscriptions'/>
    </error>
  </iq>
Nsubscriptionsr   rf   r`   r   zretrieve-subscriptionsfeatureNr   )z!http://jabber.org/protocol/pubsubpubsub)z(http://jabber.org/protocol/pubsub#errorsunsupported)r   r6   r   rq   r   exceptionFromStanzaassertIsInstancer_   r   r   r`   r3   r   )r   r   pr   ucr   s   &     r   
test_basic#ExceptionFromStanzaTests.test_basic   s    0  01MN	_%g&&		o'@AB\\UV09**62fe&7&782F4D4DE6;;/001!foo.r   c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   r     s     / /T /r   c                   \         P                  ! R4      pVP                  RRR7      pVP                  RRR7      pRVR&   \        P                  ! V4      pV P                  V\        P                  4       V P                  R	VP                  4       V P                  R
VP                  4       V P                  RVP                  4       V P                  V.VP                  4       R# )a  
Test legacy operations of exceptionFromStanza.

Given a realistic stanza with only legacy (pre-XMPP) error information,
check if a sane exception is returned.

Using this stanza::

  <message type='error'
           to='piers@pipetree.com/Home'
           from='qmacro@jaber.org'>
    <body>Are you there?</body>
    <error code='502'>Unable to resolve hostname.</error>
  </message>
NbodyzAre you there?)contentr   zUnable to resolve hostname.502ra   r{   r]   r   )r   r6   r   r   r   r   r_   r   r   r`   r%   r   )r   r   r   r   r   s   &    r   test_legacy$ExceptionFromStanzaTests.test_legacy  s       01f.>?g/LM&	**62fe&7&78.0@0@A-6D!foo.r   r   N)r:   r;   r<   r=   r   r   r>   r?   r@   s   @r   r   r      s     &/ &/P/ /r   r   c                   2   a  ] tR tRt o V 3R lR ltRtV tR# )ExceptionFromStreamErrorTestsi(  c                   < V ^8  d   QhRR/# r
   r   )r   r   s   "r   r   *ExceptionFromStreamErrorTests.__annotate__)  s     B BD Br   c                   \         P                  ! R4      pVP                  \        R34       \        P
                  ! V4      pV P                  V\        P                  4       V P                  RVP                  4       R# )a+  
Test basic operations of exceptionFromStreamError.

Given a realistic stream error, check if a sane exception is returned.

Using this error::

  <stream:error xmlns:stream='http://etherx.jabber.org/streams'>
    <xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
  </stream:error>
zxml-not-well-formedN)r   r   )
r   r6   r   rM   r   exceptionFromStreamErrorr   rF   r   r   )r   r   r   s   &  r   r   (ExceptionFromStreamErrorTests.test_basic)  sb     NNHI	o'<=>//2fe&7&78.0@0@Ar   r   N)r:   r;   r<   r=   r   r>   r?   r@   s   @r   r   r   (  s     B Br   r   N)r   twisted.trialr   twisted.words.protocols.jabberr   twisted.words.xishr   r)   rG   rM   rq   TestCaser   rB   rY   r   r   r   r   r   r   <module>r      s   
 # 0 %	//
77&.X&& &.R<x(( <8G@x(( G@T=<h'' =<@C/x00 C/LBH$5$5 Br   