
    bm
                     ^    d Z ddlZddlZddlZddlmZ ddlmZ dZdZ	 G d de          Z
dS )	z!Blackbox tests for traffic_leaner    N)traffic)BlackboxTestCasezscript/traffic_learnerz$python/samba/tests/blackbox/testdatac                       e Zd Zd Zd ZdS )TrafficLearnerTestsc                 <    |                      t          d           dS )z:Run the script with no output file specified. Should fail.   N)check_exit_codeLEARNER)selfs    F/usr/lib/python3/dist-packages/samba/tests/blackbox/traffic_learner.pytest_no_output_filez'TrafficLearnerTests.test_no_output_file!   s    Wa(((((    c                 p   |                                  5 }t          j                            t          d          }t
          d|d|}|                     |           t          j                            t          d          }t          j                    }t          |          }|
                    |           |                                 t          |          }t          j                    }|
                    |           |                                 d |j                                        D             }d |j                                        D             }	|                     |	|           d |j                                        D             }
d |j                                        D             }|                     ||
           |                     |j        |j                   |                     |j        |j                   t          |          5 }t          |          5 }t%          j
        |          }t%          j
        |          }|                     ||           d	d	d	           n# 1 swxY w Y   d	d	d	           n# 1 swxY w Y   d	d	d	           d	S # 1 swxY w Y   d	S )
zLEnsure a model is generated from a summary file and it is
           correctztraffic-sample-very-short.txt z --out ztraffic_learner.expectedc                 4    i | ]\  }}|t          |          S  sorted.0kvs      r   
<dictcomp>z=TrafficLearnerTests.test_model_generation.<locals>.<dictcomp>9   s$    LLLdaQq		LLLr   c                 4    i | ]\  }}|t          |          S r   r   r   s      r   r   z=TrafficLearnerTests.test_model_generation.<locals>.<dictcomp>:   s$    PPP1q&))PPPr   c                 4    i | ]\  }}|t          |          S r   r   r   s      r   r   z=TrafficLearnerTests.test_model_generation.<locals>.<dictcomp>>   s$    TTTtq!aTTTr   c                 4    i | ]\  }}|t          |          S r   r   r   s      r   r   z=TrafficLearnerTests.test_model_generation.<locals>.<dictcomp>?   s$    XXXA6!99XXXr   N)mktempospathjoinDATA_DIRr
   	check_runr   TrafficModelopenloadclosengramsitemsassertEqualquery_detailscumulative_durationpacket_ratejson)r   outputsummarycommandexpected_fnexpectedfactualactual_ngramsexpected_ngramsactual_detailsexpected_detailsf1f2expected_jsonactual_jsons                   r   test_model_generationz)TrafficLearnerTests.test_model_generation%   s    [[]] 	=fgll8-LMMG*1''777FFCGNN7###',,x1KLLK+--H;AMM!GGIII6llA)++FKKNNNGGIIILLfm6I6I6K6KLLLMPP8M8M8O8OPPPO_m<<<TTv7K7Q7Q7S7STTTNXX9O9U9U9W9WXXX-~>>>X96;UVVVX163EFFFk"" =b$v,, =" $	""imm  <<<= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =7	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=sZ   HJ+!J1?I<0J<J  JJ JJ+J	J+J	J++J/2J/N)__name__
__module____qualname__r   r=   r   r   r   r   r      s2        ) ) )"= "= "= "= "=r   r   )__doc__r   r-   tempfilesamba.emulater   samba.testsr   r
   r!   r   r   r   r   <module>rE      s   $ ( ' 				   ! ! ! ! ! ! ( ( ( ( ( (#1(= (= (= (= (=* (= (= (= (= (=r   