%PDF- %PDF-
Direktori : /usr/lib/python3/dist-packages/twisted/mail/test/__pycache__/ |
Current File : //usr/lib/python3/dist-packages/twisted/mail/test/__pycache__/test_mailmail.cpython-312.pyc |
� Ϫ�fi2 � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ G d� de� Zy)zi Tests for L{twisted.mail.scripts.mailmail}, the implementation of the command line program I{mailmail}. � N)�StringIO)�skipIf)�version)�Deferred)� MemoryReactor)�smtp)�mailmail)�parseOptions)�Failure)�platformType)�TestCasec � � e Zd ZdZ e� Zd� Zd� Zd� Zd� Z d� Z d� Zd� Zd � Z d � Zd� Zd� Zd � Z eedk( d� d� � Z eedk( d� d� � Zd� Zd� Zd� Zy)�OptionsTestsz� Tests for L{parseOptions} which parses command line arguments and reads message text from stdin to produce an L{Options} instance which can be used to send a message. c � � � t � � _ ddlm}m} |� j � }� j t d ||�� � d� _ d� _ d� _ � fd�}� j t d|� y)zz Override some things in mailmail, so that we capture C{stdout}, and do not call L{reactor.stop}. r )�Logger�textFileLogObserver�_log)�observerNc � �� | �_ |�_ |�_ t j | |j |j |j �j �� S )N)�reactor) �host�options�identr �sendmail�sender�to�body� memoryReactor)r r r �selfs ��A/usr/lib/python3/dist-packages/twisted/mail/test/test_mailmail.pyr z$OptionsTests.setUp.<locals>.sendmail3 sJ �� ��D�I�"�D�L��D�J��=�=������ � �����*�*�� � r ) r �out�twisted.loggerr r �patchr r r r )r r r �logObserverr s ` r �setUpzOptionsTests.setUp# s` �� � �:���>�)�$�(�(�3��� � �8�V�V�[�%A�B��� ������ � � � � �8�Z��2r! c � � | j t dt d� � | j t t g � }| j |j d� y)z� If no recipients are given in the argument list and there is no recipient header in the message text, L{parseOptions} raises L{SystemExit} with a string describing the problem. �stdinzSubject: foo Hello, goodbye. )zNo recipients specified.N)r$ �sysr �assertRaises� SystemExitr �assertEqual�args�r �excs r �test_unspecifiedRecipientsz'OptionsTests.test_unspecifiedRecipientsA sC � � � � �3���*S�!T�U���� �L�"�=��������#@�Ar! c �t � | j t t dg� }| j |j d� y)z� The I{-bp} option for listing queue information is unsupported and if it is passed to L{parseOptions}, L{SystemExit} is raised. z-bp�zUnsupported option.N�r* r+ r r, r- r. s r �test_listQueueInformationz&OptionsTests.test_listQueueInformationK s/ � � ��� �L�5�'�B��������#;�<r! c �t � | j t t dg� }| j |j d� y)z� The I{-bs} option for using stdin and stdout as the SMTP transport is unsupported and if it is passed to L{parseOptions}, L{SystemExit} is raised. z-bsr2 Nr3 r. s r �test_stdioTransportz OptionsTests.test_stdioTransportS �/ � � ��� �L�5�'�B��������#;�<r! c �� � | j t t dg� }| j |j d� | j t t dg� }| j |j d� y)z� The I{-i} and I{-oi} options for ignoring C{"."} by itself on a line are unsupported and if either is passed to L{parseOptions}, L{SystemExit} is raised. z-ir2 z-oiNr3 r. s r �test_ignoreFullStopz OptionsTests.test_ignoreFullStop\ sZ � � ��� �L�4�&�A��������#;�<���� �L�5�'�B��������#;�<r! c �t � | j t t dg� }| j |j d� y)z� The I{-om} option for copying the sender if they appear in an alias expansion is unsupported and if it is passed to L{parseOptions}, L{SystemExit} is raised. z-omr2 Nr3 r. s r �test_copyAliasedSenderz#OptionsTests.test_copyAliasedSenderg r7 r! c � � t � }| j t d|� | j t t d� }| j |j d� |j � }| j |dt � d�� y)z~ The I{--version} option displays the version and raises L{SystemExit} with L{None} as the exit code. �stdoutz --versionNzmailmail version: � ) r r$ r) r* r+ r r, �code�getvaluer )r r"