#NEWLINE# def testParseRequisitionDetailsJson( self ) : #NEWLINE# #INDENT# with open ( os . path . join ( self . datapath , 'sample_requisition_details.json' ) ) as f : #NEWLINE# #INDENT# requisition = RequisitionDetails . from_json ( json . loads ( f . read ( ) ) ) #NEWLINE# #UNINDENT# self . assertEqual ( 1 , requisition . id ) #NEWLINE# self . assertEqual ( 'HIV' , requisition . program_id ) #NEWLINE# self . assertEqual ( 'F10' , requisition . agent_code ) #NEWLINE# self . assertEqual ( False , requisition . emergency ) #NEWLINE# self . assertEqual ( 1358274600000 , requisition . period_start_date ) #NEWLINE# self . assertEqual ( 1359570599000 , requisition . period_end_date ) #NEWLINE# self . assertEqual ( 1 , len ( requisition . products ) ) #NEWLINE# self . assertEqual ( 'P10' , requisition . products [ 0 ] . code ) #NEWLINE# self . assertEqual ( 3 , requisition . products [ 0 ] . beginning_balance ) #NEWLINE# self . assertEqual ( 0 , requisition . products [ 0 ] . quantity_received ) #NEWLINE# self . assertEqual ( 1 , requisition . products [ 0 ] . quantity_dispensed ) #NEWLINE# self . assertEqual ( ( - 2 ) , f . products [ 0 ] . total_losses_and_adjustments ) #NEWLINE# self . assertEqual ( 0 , requisition . products [ 0 ] . stock_in_hand ) #NEWLINE# self . assertEqual ( 2 , requisition . products [ 0 ] . new_patient_count ) #NEWLINE# self . assertEqual ( 2 , requisition . products [ 0 ] . stock_out_days ) #NEWLINE# self . assertEqual ( 3 , requisition . products [ 0 ] . quantity_requested ) #NEWLINE# self . assertEqual ( 'reason' , requisition . products [ 0 ] . reason_for_requested_quantity ) #NEWLINE# self . assertEqual ( 57 , requisition . products [ 0 ] . calculated_order_quantity ) #NEWLINE# self . assertEqual ( 65 , requisition . products [ 0 ] . quantity_approved ) #NEWLINE# self . assertEqual ( '1' , requisition . products [ 0 ] . remarks ) #NEWLINE# self . assertEqual ( 'RELEASED' , requisition . requisition_status ) #NEWLINE# self . assertEqual ( 1 , requisition . order_id ) #NEWLINE# self . assertEqual ( 'RELEASED' , requisition . order_status ) #NEWLINE# self . assertEqual ( 'F10' , requisition . supplying_facility_code )