HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3.9/site-packages/tracer/tests/__pycache__/test_views.cpython-39.pyc
a

�|
`'�@s&ddlmZddlTddlmZddlmZddlmZddl	m
Z
mZddlm
Z
dd	lmZdd
lmZmZddlZddlZddlZddlZejdd
dgd�ZejZzddlmZWnddlmZYn0eejj_eejj_eejj _Gdd�de!j"�Z#Gdd�de$�Z%Gdd�de$�ZdS)�)�unicode_literals�)�*)�StringIO)�DefaultView)�
HelperView)�Applications�Application)�ApplicationsCollection)�Package)�ProcessMock�AffectedProcessMockN�tracerT�en)�fallback�	languages)�patchc@sxeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
eddd�dd��ZdS)�	TestViewscCst�|_dS�N)r�out��self�r�;/usr/lib/python3.9/site-packages/tracer/tests/test_views.py�setUp#szTestViews.setUpcCsFt|j�}|�dt��|�dtg��|��|�|j��d�dS)N�args�applications�)rr�assign�ArgsMockr
�render�assertEqual�getvalue�r�viewrrr�test_default_none&s

zTestViews.test_default_nonecCspt|j�}|�dt��|�dttdddd��tdddd��tdddd��g��|��|�|j��d�dS)	Nrr�application�first helper��type�helper�name�
second helper�third helperzkYou should restart:
  * Some applications using:
      first helper
      second helper
      third helper
�	rrrrr
r	r r!r"r#rrr�test_default_with_helpers-s
��z#TestViews.test_default_with_helperscCspt|j�}|�dt��|�dttdddd��tdddd��tdddd��g��|��|�|j��d�dS)	Nrrr&�foo�r)r+r*�bar�bazzSYou should restart:
  * These applications manually:
      bar
      baz
      foo
r.r#rrr�test_default_without_helpers>s
��z&TestViews.test_default_without_helperscCs�t|j�}|�dt��|�dttdddd��tdddd��tdddd��tdddd	��tdd
dd	��tdddd	��g��|��|�|j��d�dS)
Nrrr&r'r(r,r-r0r1r2r3z�You should restart:
  * Some applications using:
      first helper
      second helper
      third helper

  * These applications manually:
      bar
      baz
      foo
r.r#rrr�!test_default_with_without_helpersOs
��z+TestViews.test_default_with_without_helperscCstt|j�}|�dtdd��|�dttdddd��tdd	d
d��tdddd��g��|��|�|j��d
�dS)NrT��allr�sessionr0�h1r1r2�h2r3�h3zbYou should restart:
  * These applications restarting your session:
      bar
      baz
      foo
r.r#rrr�test_default_all_sessionhs
��z"TestViews.test_default_all_sessioncCstt|j�}|�dtdd��|�dttdddd��tdd	d
d��tdddd��g��|��|�|j��d
�dS)NrTr6r�staticr0r9r1r2r:r3r;zbYou should restart:
  * These applications rebooting your computer:
      bar
      baz
      foo
r.r#rrr�test_default_all_staticys
��z!TestViews.test_default_all_staticcCs�t|j�}|�dtdd��|�dttdddd��tdd	d
d��tdddd��td
ddd��td
ddd��td
ddd��g��|��|�|j��d�dS)NrTr6rr8r0r9r1r2r:r3r;r=�aaa�h4�bbbZh5ZcccZh6z�You should restart:
  * These applications restarting your session:
      bar
      baz
      foo

  * These applications rebooting your computer:
      aaa
      bbb
      ccc
r.r#rrr�test_default_all_session_static�s
��z)TestViews.test_default_all_session_staticcCs�t|j�}|�dtdd��|�dttdddd��tdddd��tdd	dd
��tdddd
��tdd
dd
��tdddd
��tdddd
��tdddd
��g��|��|�|j��d�dS)NrTr6rr&r'r(r,r0r1r2r8r3r9�quxr:r=r?r;rAr@aYou 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
r.r#rrr�test_default_all�s 
�
�zTestViews.test_default_allcCs�t|j�}|�dt��|�dttdddd��tdddd��tdddd��tdd	dd��td
ddd��td
d
dd��tdddd��g��|��|�|j��d�dS)Nrrr&r'r(r,r0r1r2r8r3r9rCr:r=r?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
r.r#rrr�test_default_not_all�s
�	�zTestViews.test_default_not_allcCspt|j�}|�dt��|�dttdddd��tdddd��td	d
dd��g��|��|�|j��d�dS)
Nrrr8r0r9r1r2r:r=r3r;z�There are:
  - 2 processes requiring restart of your session (i.e. Logging out & Logging in again)
  - 1 processes requiring reboot
r.r#rrr�test_default_note_only�s
��z TestViews.test_default_note_onlyz0tracer.resources.applications.System.init_systemZdummy)Zreturn_valuecCs�tdddddg�tdddddg�g}td	�}d|_d
|_d|_ddg|_td�}t|g�|_|g}t	|j
�}|�dtdd
��|�d|�|�dt
�d��|�d|�|�d|�|�dd�|��|�|j
��d�dS)N�r0i�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rZmodified�description�category�filesr
�setZpackagesrrrrr�findr r!r")rZinit_systemrJrKZa1rLr$rrr�test_helper�s,�

�zTestViews.test_helperN)�__name__�
__module__�__qualname__rr%r/r4r5r<r>rBrDrErFrrRrrrrr!s!
rc@seZdZdZZddd�ZdS)rNFcCs||_||_||_||_dSr)r7�quiet�userrI)rr7rVrWrIrrr�__init__szArgsMock.__init__)FFFF)rSrTrUr7rVrXrrrrrsrc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)rcCs(d|_||_||_||_||_d|_dS)Nz	some-time)�parent�pidrO�_name�_create_timeZstr_started_ago)rrZr+�create_timerOrrrrX"szProcessMock.__init__cCs|jSr)r[rrrrr+*szProcessMock.namecCs|jSr)r\rrrrr]-szProcessMock.create_timecCsgSrrrrrr�children0szProcessMock.childrencCsdSrrrrrr�username3szProcessMock.usernameN)rSrTrUrXr+r]r^r_rrrrr!s
r)&Z
__future__rZ__meta__Ztracer.resources.pycomprZtracer.views.defaultrZtracer.views.helperrZtracer.resources.applicationsrr	Ztracer.resources.collectionsr
Ztracer.resources.packagerZtest_tracerrr
rZtracer.views.note_for_hidden�gettext�translation�tZugettext�_Z
unittest.mockrZmockZviews�defaultr*Znote_for_hiddenZunittestZTestCaser�objectrrrrr�<module>s2


w