+
    üÐj  ã                   óŽ   € R t ^ RIHtHt ^ RIHt ^ RIHtHt ^ RI	H
t
 ^ RIHt  ! R R]4      t ! R R	4      t ! R
 R]4      tR# )z 
Tests for L{twisted.mail.tap}.
)ÚdeferÚ	endpoints)Ú	protocols)ÚOptionsÚmakeService)Ú
UsageError)ÚTestCasec                   óf   a € ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tRtV tR# )ÚOptionsTestszC
Tests for the command line option parser used for I{twistd mail}.
c                óÈ   € V P                  4       V n        \        V P                  R 4      ;_uu_ 4       pVP                  R4       RRR4       R#   + '       g   i     R# ; i)Úwzsomeuser:	differentuser
N)ÚmktempÚaliasFilenameÚopenÚwrite)ÚselfÚ	aliasFiles   & Ú@/usr/lib/python3/dist-packages/twisted/mail/test/test_options.pyÚsetUpÚOptionsTests.setUp   sA   € Ø!Ÿ[™[›]ˆÔÜ�$×$Ñ$ c×*Ô*¨iØ�O‰OÐ8Ô9÷ +×*×*Ò*ús   ´AÁA!	c                óp   € V P                  \        \        4       P                  RV P                  .4       R# )zQ
Test that adding an aliases(5) file before adding a domain raises a
UsageError.
ú	--aliasesN)ÚassertRaisesr   r   ÚparseOptionsr   ©r   s   &r   ÚtestAliasesWithoutDomainÚ%OptionsTests.testAliasesWithoutDomain   s,   € ð
 	×ÑÜœ›	×.Ñ.°¸d×>PÑ>PÐ0Qö	
ó    c                óT   € \        4       P                  RRRV P                  .4       R# )zk
Test that adding an aliases(5) file to an IAliasableDomain at least
doesn't raise an unhandled exception.
z--maildirdbmdomainzexample.com=example.comr   N)r   r   r   r   s   &r   ÚtestAliasesÚOptionsTests.testAliases"   s+   € ô
 	‹	×Ñà$Ø)ØØ×"Ñ"ð	ö	
r   c                óê   € \        4       pVP                  RV,           R.4       V P                  \        W!,          4      ^4       V P	                  W!,          ^ ,          \
        P                  4       R# )z™
Use L{Options} to parse a single service configuration parameter and
verify that an endpoint of the correct type is added to the list for
that service.
z--ztcp:1234N©r   r   ÚassertEqualÚlenÚassertIsInstancer   ÚTCP4ServerEndpoint)r   ÚserviceÚoptionss   && r   Ú_endpointTestÚOptionsTests._endpointTest0   sX   € ô “)ˆØ×Ñ˜d W�n¨jÐ9Ô:Ø×Ñœ˜WÕ-Ó.°Ô2Ø×Ñ˜gÕ.¨qÕ1´9×3OÑ3OÖPr   c                ó(   € V P                  R4       R# )z€
When I{--smtp} is given a TCP endpoint description as an argument, a
TCPServerEndpoint is added to the list of SMTP endpoints.
ÚsmtpN©r)   r   s   &r   Útest_endpointSMTPÚOptionsTests.test_endpointSMTP;   ó   € ð
 	×Ñ˜6Ö"r   c                ó(   € V P                  R4       R# )z€
When I{--pop3} is given a TCP endpoint description as an argument, a
TCPServerEndpoint is added to the list of POP3 endpoints.
Úpop3Nr-   r   s   &r   Útest_endpointPOP3ÚOptionsTests.test_endpointPOP3B   r0   r   c                ó|  € \        4       pVP                  . 4       V P                  \        VR,          4      ^4       V P	                  VR,          ^ ,          \
        P                  4       V P                  \        VR,          4      ^4       V P	                  VR,          ^ ,          \
        P                  4       R# )z?
POP3 and SMTP each listen on a TCP4ServerEndpoint by default.
r2   r,   Nr"   ©r   r(   s   & r   Útest_protoDefaultsÚOptionsTests.test_protoDefaultsI   s‰   € ô “)ˆØ×Ñ˜RÔ à×Ñœ˜W V�_Ó-¨qÔ1Ø×Ñ˜g f�o¨aÕ0´)×2NÑ2NÔOà×Ñœ˜W V�_Ó-¨qÔ1Ø×Ñ˜g f�o¨aÕ0´)×2NÑ2NÖOr   c                ó†  € \        4       pVP                  R.4       V P                  VP                  RR4      . 4       V P	                  VP                  RR4      . 4       \        4       pVP                  R.4       V P	                  VP                  RR4      . 4       V P                  VP                  RR4      . 4       R# )zO
The I{--no-pop3} and I{--no-smtp} options disable POP3 and SMTP
respectively.
ú	--no-pop3Nr2   r,   ú	--no-smtp)r   r   r#   Ú_getEndpointsÚassertNotEqualr6   s   & r   Útest_protoDisableÚOptionsTests.test_protoDisableV   s¦   € ô
 “)ˆØ×Ñ˜k˜]Ô+Ø×Ñ˜×.Ñ.¨t°VÓ<¸bÔAØ×Ñ˜G×1Ñ1°$¸Ó?ÀÔDä“)ˆØ×Ñ˜k˜]Ô+Ø×Ñ˜G×1Ñ1°$¸Ó?ÀÔDØ×Ñ˜×.Ñ.¨t°VÓ<¸bÖAr   c                ó`   € \        4       pV P                  \        VP                  RR.4       R# )z9
If all protocols are disabled, L{UsageError} is raised.
r:   r;   N)r   r   r   r   r6   s   & r   Útest_allProtosDisabledErrorÚ(OptionsTests.test_allProtosDisabledErrore   s+   € ô “)ˆØ×ÑÜ˜×,Ñ,°¸[Ð/Iö	
r   c                ó”   € \        4       pV P                  \        VP                  R.4      pV P	                  R\        V4      4       R# )z]
If I{--esmtp} is given without I{--hostname}, L{Options.parseOptions}
raises L{UsageError}.
z--esmtpz--esmtp requires --hostnameN)r   r   r   r   r#   Ústr)r   r(   Úexcs   &  r   Útest_esmtpWithoutHostnameÚ&OptionsTests.test_esmtpWithoutHostnamen   s<   € ô
 “)ˆØ×Ñ¤
¨G×,@Ñ,@À9À+ÓNˆØ×ÑÐ6¼¸C»ÖAr   c                ó>  € \        4       pVP                  RR.4       V P                  \        VR,          4      ^4       VR,          ^ ,          pVP                  pVP
                  P                  P                  pV F  pV P                  W$V,          4       K  	  R# )z3
Tests that the --auth option registers a checker.
z--authzmemory:admin:admin:bob:passwordÚcredCheckersN)r   r   r#   r$   ÚcredentialInterfacesr'   Ú
smtpPortalÚcheckers)r   r(   ÚcheckerÚ
interfacesÚregistered_checkersÚifaces   &     r   Ú	test_authÚOptionsTests.test_authw   s†   € ô “)ˆØ×Ñ˜hÐ(IÐJÔKØ×Ñœ˜W ^Õ4Ó5°qÔ9Ø˜.Õ)¨!Õ,ˆØ×1Ñ1ˆ
Ø%Ÿo™o×8Ñ8×AÑAÐÛˆEØ×Ñ˜W¸%Õ&@ÖAó  r   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r)   r.   r3   r7   r>   rA   rF   rQ   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r
   r
      sL   ø‡ € ñò:ò

ò
ò	Qò#ò#òPòBò
òB÷Bð Br   r
   c                   ó.   a € ] tR t^…t o RtRtR tRtV tR# )ÚSpyEndpointz?
SpyEndpoint remembers what factory it is told to listen with.
Nc                ó:   € Wn         \        P                  ! R 4      # )N)ÚlisteningWithr   Úsucceed)r   Úfactorys   &&r   ÚlistenÚSpyEndpoint.listenŒ   s   € Ø$ÔÜ�}Š}˜TÓ"Ð"r   )r_   )	rS   rT   rU   rV   rW   r_   rb   rX   rY   rZ   s   @r   r]   r]   …   s   ø‡ € ñð €M÷#ð #r   r]   c                   ó6   a € ] tR t^‘t o RtR tR tR tRtV t	R# )ÚMakeServiceTestsz+
Tests for L{twisted.mail.tap.makeService}
c                óH  € \        4       p\        4       p\        4       pW4.WQ&   \        V4      pVP                  4        VP	                  4        V P                  VP                  4       V P                  VP                  V4       V P                  VP                  V4       R# )zÁ
Configure a service with two endpoints for the protocol associated with
C{key} and verify that when the service is started a factory of type
C{factoryClass} is used to listen on each of them.
N)	r]   r   r   ÚprivilegedStartServiceÚstartServiceÚ
addCleanupÚstopServicer%   r_   )r   ÚkeyÚfactoryClassÚ	cleartextÚsecureÚconfigr'   s   &&&    r   Ú_endpointServerTestÚ$MakeServiceTests._endpointServerTest–   sƒ   € ô  “Mˆ	Ü“ˆÜ“ˆØ Ð)ˆ‰Ü˜fÓ%ˆØ×&Ñ&Ô(Ø×ÑÔØ�‰˜×+Ñ+Ô,Ø×Ñ˜i×5Ñ5°|ÔDØ×Ñ˜f×2Ñ2°LÖAr   c                óF   € V P                  R\        P                  4       R# )zÖ
If one or more endpoints is included in the configuration passed to
L{makeService} for the C{"pop3"} key, a service for starting a POP3
server is constructed for each of them and attached to the returned
service.
r2   N)rp   r   ÚPOP3Factoryr   s   &r   Ú	test_pop3ÚMakeServiceTests.test_pop3§   ó   € ð 	× Ñ  ¬×)>Ñ)>Ö?r   c                óF   € V P                  R\        P                  4       R# )z×
If one or more endpoints is included in the configuration passed to
L{makeService} for the C{"smtp"} key, a service for starting an SMTP
server is constructed for each of them and attached to the returned
service.
r,   N)rp   r   ÚSMTPFactoryr   s   &r   Ú	test_smtpÚMakeServiceTests.test_smtp°   rv   r   © N)
rS   rT   rU   rV   rW   rp   rt   ry   rX   rY   rZ   s   @r   re   re   ‘   s"   ø‡ € ñòBò"@÷@ð @r   re   N)rW   Útwisted.internetr   r   Útwisted.mailr   Útwisted.mail.tapr   r   Útwisted.python.usager   Útwisted.trial.unittestr   r
   r]   re   r{   r   r   Ú<module>r�      sD   ðñ÷ .Ý "ß 1Ý +Ý +ôsB�8ô sB÷l	#ñ 	#ô&@�xö &@r   