a "e¡ ã@sbddlTddlmZmZddlmZmZddlmZddl m Z m Z m Z m Z Gdd„dejƒZd S) é)Ú*é)Ú ApplicationsÚ Application)Ú ProcessesÚAffectedProcess)ÚPackage)ÚApplicationsCollectionÚProcessesCollectionÚPackagesCollectionÚAffectedProcessesCollectionc@sXeZdZdd„Zdd„Zdd„Ze dd¡d d „ƒZd d „Z d d„Z dd„Z dd„Z dS)ÚTestCollectionscCsŒtj}tdd|dœƒ}tdd|dœƒ}tdd|dœƒ}t|||gƒ}| | d¡t|||gƒ¡| | d ¡t|||gƒ¡| |t¡dS) NÚfooÚbar©ÚnameÚhelperÚtypeÚbazÚquxZquuxZcorgerr)rÚ DEFAULT_TYPErr Ú assertEqualÚsortedÚassertIsInstance)ÚselfÚ default_typeÚa1Úa2Úa3Ú collection©r úA/usr/lib/python3.9/site-packages/tracer/tests/test_collections.pyÚtest_applications_sorted sz(TestCollections.test_applications_sortedcCs<t ¡}| |t¡| | d¡t¡| | d¡t¡dS)NÚusergff†§ÕA)rÚallrr Úowned_byZ newer_than©rrr r r!Útest_processes_typess z$TestCollections.test_processes_typescCs"t ¡ d¡}| t|ƒd¡dS)Nr)rr$r%Z assertGreaterÚlenr&r r r!Útest_processes_none_usersz(TestCollections.test_processes_none_userTz%@TODO Create Mock for Processes classcCsdtdƒ}tdƒ}tgd¢ƒ|_tƒ}| |g¡| |g¡| ||¡| d|| |¡j¡dS)NiÒ)rrrr)rÚsetÚfilesr ÚupdateZassertInÚindex)rÚp1Úp2Úcr r r!Útest_processes_updates   z%TestCollections.test_processes_updatecCs’tdƒ}tdƒ}tdƒ}tddƒ}tdƒ}t||||gƒ}| | ||g¡ d¡t||gƒ d¡¡| | d¡|¡| | |g¡dj¡dS)Nrrrré{rr)rr rÚ intersectionrZassertIsNotNoneZmodified)rr.r/Zp3Zp4Zp5Úc1r r r!Útest_packages_intersection,s *z*TestCollections.test_packages_intersectioncCsxtddiƒ}tddiƒ}tddiƒ}t|||gƒ}dd„|Dƒhd£ksLJ‚| ddd¡d d„|Dƒhd £kstJ‚dS) NrrrrcSsh|] }|j’qSr ©r©Ú.0Úar r r!Ú =óz6TestCollections.test_replace_values..>rrrrcSsh|] }|j’qSr r6r7r r r!r:?r;>rrr)rr Zreplace_values)rrrrr4r r r!Útest_replace_values7s   z#TestCollections.test_replace_valuescCsPt ¡}| d¡}tt|ƒdƒD](}|| ¡||d ¡kr"tdƒ‚q"dS)NÚ create_timerz$The collection isn't sorted properly)rr$rÚranger(r=Ú Exception)rr4Zc2Úir r r!Útest_collection_sorted_callableAs  z/TestCollections.test_collection_sorted_callablecCsZtj}tdd|dœƒ}tdd|dœƒ}t||gƒ}| d¡}| dd„|Dƒddg¡dS) za https://github.com/FrostyX/tracer/issues/151 https://github.com/FrostyX/tracer/issues/156 rNrrrrcSsg|] }|j‘qSr )r)r8Zappr r r!Ú Sr;zGTestCollections.test_application_sorted_none_helper..)rrrr rr)rrrrrZcollection_sortedr r r!Ú#test_application_sorted_none_helperIs  ÿz3TestCollections.test_application_sorted_none_helperN) Ú__name__Ú __module__Ú __qualname__r"r'r)ÚunittestZskipIfr1r5r<rArCr r r r!r s     r N)Z__meta__Ztracer.resources.applicationsrrZtracer.resources.processesrrZtracer.resources.packagerZtracer.resources.collectionsr r r r rGZTestCaser r r r r!Ús