#NEWLINE# def test_ota_consumption( self ) : #NEWLINE# #INDENT# self . ct_settings . consumption_config = ConsumptionConfig ( min_transactions = 0 , min_window = 0 , optimal_window = 60 ) #NEWLINE# self . ct_settings . ota_restore_config = StockRestoreConfig ( section_to_consumption_types = { #NEWLINE# #INDENT# 'stock' : 'consumption' , #NEWLINE# #UNINDENT# } ) #NEWLINE# set_default_monthly_consumption_for_domain ( self . domain . name , ( 5 * DAYS_IN_MONTH ) ) #NEWLINE# self . _save_settings_and_clear_cache ( ) #NEWLINE# amounts = [ ( p . _id , ( i * 10 ) ) for ( i , p ) in enumerate ( self . products ) ] #NEWLINE# report = _report_soh ( amounts , self . sp . case_id , 'stock' ) #NEWLINE# balance_blocks = _get_ota_balance_blocks ( self . domain , self . user ) #NEWLINE# self . assertEqual ( 2 , len ( balance_blocks ) ) #NEWLINE# ( stock_block , consumption_block ) = balance_blocks #NEWLINE# check_xml_line_by_line ( self , balance_ota_block ( self . sp , 'stock' , amounts , datestring = json_format_datetime ( report . date ) ) , stock_block ) #NEWLINE# check_xml_line_by_line ( self , balance_ota_block ( self . sp , 'consumption' , [ ( p . _id , 150 ) for p in self . products ] , datestring = json_format_datetime ( p . date ) ) , consumption_block )