관리-도구
편집 파일: test_views.cpython-39.pyc
a ����"e@'����������������������@���s&��d�dl�mZ�ddlT�d�dlmZ�d�dlmZ�d�dlmZ�d�dl m Z mZ�d�dlm Z �d�d lmZ�dd lmZmZ�d�dlZd�dlZd�dlZd�dlZejdd dgd�ZejZzd�dlmZ�W�n���d�dlmZ�Y�n0�eejj_eejj_eejj _G�dd��de!j"�Z#G�dd��de$�Z%G�dd��de$�ZdS�)�����)�unicode_literals����)�*)�StringIO)�DefaultView)� HelperView)�Applications�Application)�ApplicationsCollection)�Package)�ProcessMock�AffectedProcessMockN�tracerT�en)�fallback� languages)�patchc�������������������@���sx���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z dd��Z dd��Zdd��Zdd��Z eddd�dd���ZdS�)� TestViewsc�����������������C���s���t���|�_d�S��N)r����out��self��r����;/usr/lib/python3.9/site-packages/tracer/tests/test_views.py�setUp#���s����zTestViews.setUpc�����������������C���sF���t�|�j�}|�dt����|�dtg����|����|��|�j���d��d�S�)N�args�applications��)r���r����assign�ArgsMockr ����render�assertEqual�getvalue�r����viewr���r���r����test_default_none&���s ���� zTestViews.test_default_nonec�����������������C���sp���t�|�j�}|�dt����|�dttdddd��tdddd��tdd d d��g���|����|��|�j���d��d�S�)Nr���r����application�first helper�first��type�helper�name� second helper�second�third helper�thirdzkYou should restart: * Some applications using: first helper second helper third helper � r���r���r���r���r ���r ���r ���r!���r"���r#���r���r���r����test_default_with_helpers-���s���� ��z#TestViews.test_default_with_helpersc�����������������C���sp���t�|�j�}|�dt����|�dttddd�d��tddd�d��tddd�d��g���|����|��|�j���d��d�S�) Nr���r���r&����foo�r*���r,���r+����bar�bazzSYou should restart: * These applications manually: bar baz foo r1���r#���r���r���r����test_default_without_helpers>���s���� ��z&TestViews.test_default_without_helpersc�����������������C���s����t�|�j�}|�dt����|�dttdddd��tdddd��tdd d d��tddd�d��tdd d�d��tddd�d��g���|����|��|�j���d��d�S�)Nr���r���r&���r'���r(���r)���r-���r.���r/���r0���r3���r4���r5���r6���z�You should restart: * Some applications using: first helper second helper third helper * These applications manually: bar baz foo r1���r#���r���r���r����!test_default_with_without_helpersO���s���� ��z+TestViews.test_default_with_without_helpersc�����������������C���st���t�|�j�}|�dtdd���|�dttdddd��tdd d d��tdddd��g���|����|��|�j���d ��d�S�)Nr���T��allr����sessionr3����h1r4���r5����h2r6����h3zbYou should restart: * These applications restarting your session: bar baz foo r1���r#���r���r���r����test_default_all_sessionh���s���� ��z"TestViews.test_default_all_sessionc�����������������C���st���t�|�j�}|�dtdd���|�dttdddd��tdd d d��tdddd��g���|����|��|�j���d ��d�S�)Nr���Tr9���r����staticr3���r<���r4���r5���r=���r6���r>���zbYou should restart: * These applications rebooting your computer: bar baz foo r1���r#���r���r���r����test_default_all_staticy���s���� ��z!TestViews.test_default_all_staticc�����������������C���s����t�|�j�}|�dtdd���|�dttdddd��tdd d d��tdddd��td ddd��td ddd��td ddd��g���|����|��|�j���d��d�S�)Nr���Tr9���r���r;���r3���r<���r4���r5���r=���r6���r>���r@����aaa�h4�bbbZh5ZcccZh6z�You should restart: * These applications restarting your session: bar baz foo * These applications rebooting your computer: aaa bbb ccc r1���r#���r���r���r����test_default_all_session_static����s���� ��z)TestViews.test_default_all_session_staticc�����������������C���s����t�|�j�}|�dtdd���|�dttdddd��tdd d d��tddd�d��tdd d�d��tdddd��tdddd��tdddd��tdddd��g���|����|��|�j���d��d�S�)Nr���Tr9���r���r&���r'���r(���r)���r-���r.���r3���r4���r5���r;���r6���r<����quxr=���r@���rB���r>���rD���rC���a��You should restart: * Some applications using: first helper second helper * These applications manually: bar foo * These applications restarting your session: baz qux * These applications rebooting your computer: aaa bbb r1���r#���r���r���r����test_default_all����s ���� � �zTestViews.test_default_allc�����������������C���s����t�|�j�}|�dt����|�dttdddd��tdddd��tdd d�d ��tddd�d ��tdd dd ��tdddd ��tdddd ��g���|����|��|�j���d��d�S�)Nr���r���r&���r'���r(���r)���r-���r.���r3���r4���r5���r;���r6���r<���rF���r=���r@���rB���r>���a!��You should restart: * Some applications using: first helper second helper * These applications manually: bar foo Additionally, there are: - 2 processes requiring restart of your session (i.e. Logging out & Logging in again) - 1 processes requiring reboot r1���r#���r���r���r����test_default_not_all����s���� � �zTestViews.test_default_not_allc�����������������C���sp���t�|�j�}|�dt����|�dttdddd��tdddd��td d dd��g���|����|��|�j���d��d�S�) Nr���r���r;���r3���r<���r4���r5���r=���r@���r6���r>���z�There are: - 2 processes requiring restart of your session (i.e. Logging out & Logging in again) - 1 processes requiring reboot r1���r#���r���r���r����test_default_note_only����s���� ��z TestViews.test_default_note_onlyz0tracer.resources.applications.System.init_systemZdummy)Zreturn_valuec�����������������C���s����t�dddddg�t�dddddg�g}td �}d�|_d |_d|_ddg|_td�}t|g�|_|g}t |�j �}|�dtdd ���|�d|��|�dt �d���|�d|��|�d|��|�dd���|����|��|�j ���d��d�S�)N����r3���i���Zfile1Zfile2����i.��Zfile3Z foopackagezFoo package descriptionZcategr���)�verbose� processesr&����package�affected_byZaffectsa;��* foo Package: foopackage Description: Foo package description Type: Application State: foo has been started by None some-time ago. PID - 2 foo has been started by None some-time ago. PID - 3 Affected by: foopackage file1 file2 )r���r���Zmodified�description�category�filesr ����setZpackagesr���r���r���r���r����findr ���r!���r"���)r���Zinit_systemrM���rN���Za1rO���r$���r���r���r����test_helper����s,����� �zTestViews.test_helperN)�__name__� __module__�__qualname__r���r%���r2���r7���r8���r?���rA���rE���rG���rH���rI���r���rU���r���r���r���r���r���!���s���! r���c�������������������@���s���e�Zd�Zd�ZZddd�ZdS�)r���NFc�����������������C���s���||�_�||�_||�_||�_d�S�r���)r:����quiet�userrL���)r���r:���rY���rZ���rL���r���r���r����__init__��s����zArgsMock.__init__)FFFF)rV���rW���rX���r:���rY���r[���r���r���r���r���r�����s���r���c�������������������@���s4���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��ZdS�)r���c�����������������C���s(���d�|�_�||�_||�_||�_||�_d|�_d�S�)Nz some-time)�parent�pidrR����_name�_create_timeZstr_started_ago)r���r]���r,����create_timerR���r���r���r���r[���"��s����zProcessMock.__init__c�����������������C���s���|�j�S�r���)r^���r���r���r���r���r,���*��s����zProcessMock.namec�����������������C���s���|�j�S�r���)r_���r���r���r���r���r`���-��s����zProcessMock.create_timec�����������������C���s���g�S�r���r���r���r���r���r����children0��s����zProcessMock.childrenc�����������������C���s���d�S�r���r���r���r���r���r����username3��s����zProcessMock.usernameN)rV���rW���rX���r[���r,���r`���ra���rb���r���r���r���r���r���!��s ���r���)&Z __future__r���Z__meta__Ztracer.resources.pycompr���Ztracer.views.defaultr���Ztracer.views.helperr���Ztracer.resources.applicationsr���r ���Ztracer.resources.collectionsr ���Ztracer.resources.packager���Ztest_tracerr���r ���r���Ztracer.views.note_for_hidden�gettext�translation�tZugettext�_Z unittest.mockr���ZmockZviews�defaultr+���Znote_for_hiddenZunittestZTestCaser����objectr���r���r���r���r����<module>���s2��� �w