#NEWLINE# @ skip ( 'Fix mocks' ) #NEWLINE# def test_fetch_org_units_deletes( self ) : #NEWLINE# #INDENT# '\n        sync_org_units should delete old org units\n        ' #NEWLINE# with patch ( 'custom.dhis2.models.Dhis2Api.gen_org_units' ) as gen_org_units_patch , patch ( 'custom.dhis2.models.FixtureManager.all' ) as objects_all_patch : #NEWLINE# #INDENT# delete_mock = Mock ( ) #NEWLINE# ou_obj = type ( 'OrgUnit' , ( object , ) , { #NEWLINE# #INDENT# 'id' : '1' , #NEWLINE# 'name' : 'Sri Lanka' , #NEWLINE# 'delete' : gen_org_units_patch , #NEWLINE# #UNINDENT# } ) #NEWLINE# gen_org_units_patch . side_effect = ( lambda : ( d for d in [ ] ) ) #NEWLINE# objects_all_patch . side_effect = ( lambda : ( o for o in [ ou_obj ] ) ) #NEWLINE# fetch_org_units ( ) #NEWLINE# delete_mock . assert_called ( )