#NEWLINE# def test_calling_service( self ) : #NEWLINE# #INDENT# 'Test the calling of a service.' #NEWLINE# calls = [ ] #NEWLINE# def record_call( service ) : #NEWLINE# #INDENT# 'Add recorded event to set.' #NEWLINE# calls . append ( service ) #NEWLINE# #UNINDENT# self . hass . services . register ( 'test' , 'script' , record_call ) #NEWLINE# script_obj = script . Script ( calls . hass , { #NEWLINE# #INDENT# 'service' : 'test.script' , #NEWLINE# 'data' : { #NEWLINE# #INDENT# 'hello' : 'world' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# script_obj . run ( ) #NEWLINE# self . hass . pool . block_till_done ( ) #NEWLINE# assert ( len ( calls ) == 1 ) #NEWLINE# assert ( calls [ 0 ] . data . get ( 'hello' ) == 'world' )