#NEWLINE# def test_get_resource_id( self ) : #NEWLINE# #INDENT# '\n        get_resource_id should query the API for the details of a named resource, and return the ID\n        ' #NEWLINE# if ( not SETTINGS [ 'dhis2_enabled' ] ) : #NEWLINE# #INDENT# self . skipTest ( 'DHIS2 is not configured' ) #NEWLINE# #UNINDENT# resources = { #NEWLINE# #INDENT# 'Knights' : [ { #NEWLINE# #INDENT# 'name' : 'Michael Palin' , #NEWLINE# 'id' : 'c0ffee' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# dhis2_api = Dhis2Api ( SETTINGS [ 'dhis2_host' ] , SETTINGS [ 'dhis2_username' ] , SETTINGS [ 'dhis2_password' ] ) #NEWLINE# dhis2_api . _request . get = Mock ( return_value = ( 'foo' , result ) ) #NEWLINE# result = dhis2_api . get_resource_id ( 'Knights' , 'Who Say "Ni!"' ) #NEWLINE# dhis2_api . _request . get . assert_called_with ( 'Knights' , params = { #NEWLINE# #INDENT# 'links' : 'false' , #NEWLINE# 'query' : 'Who Say "Ni!"' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( result , 'c0ffee' )