@pytest.mark.parametrize('event, cmd, expected', execute_hook_fixtures)
def test__execute_hook__works(event, cmd, expected, app):
 app.client.get_string.return_value = cmd
 with mock.patch('subprocess.Popen') as popen:
  Guake.execute_hook(app, event)
  if isinstance(cmd, (str, unicode)):
   popen.assert_called_once_with(expected)
  if (cmd is None):
   assert (popen.called == expected)

@ pytest . mark . parametrize ( 'event, cmd, expected' , execute_hook_fixtures ) def test__execute_hook__works ( event , cmd , expected , app ) : app . client . get_string . return_value = cmd with mock . patch ( 'subprocess.Popen' ) as popen : Guake . execute_hook ( app , event ) if isinstance ( cmd , ( str , unicode ) ) : popen . assert_called_once_with ( expected ) if ( cmd is None ) : assert ( popen . called == expected )
execute_hook should exec command from setting /hook/<event> if it is string or do nothing if its nonetype .