#NEWLINE# def test_policy_trigger_invalid_keyname( self ) : #NEWLINE# #INDENT# tpl_snippet = '\n        triggers:\n         - resize_compute:\n             description: trigger\n             event_type: tosca.events.resource.utilization\n             schedule:\n               start_time: "2015-05-07T07:00:00Z"\n               end_time: "2015-06-07T07:00:00Z"\n             target_filter1:\n               node: master-container\n               requirement: host\n               capability: Container\n             condition:\n               constraint: utilization greater_than 50%\n               period1: 60\n               evaluations: 1\n               method: average\n             action:\n               resize: # Operation name\n                inputs:\n                 strategy: LEAST_USED\n                 implementation: Senlin.webhook()\n        ' #NEWLINE# triggers = toscaparser . utils . yamlparser . simple_parse ( tpl_snippet ) [ 'triggers' ] [ 0 ] #NEWLINE# name = list ( triggers . keys ( ) ) [ 0 ] #NEWLINE# expectedmessage = _ ( 'Triggers "resize_compute" contains unknown field "target_filter1". Refer to the definition to verify valid values.' ) #NEWLINE# err = self . assertRaises ( exception . UnknownFieldError , ( lambda : Triggers ( name , triggers [ name ] ) ) ) #NEWLINE# self . assertEqual ( expectedmessage , err . __str__ ( ) )