#!/bin/sh

. functions

output=${1:-python}

$rekall $style --skipSplash RekallAutoTest.rkl 2>/dev/null >/dev/null &
     PID=$!
rekallID=$rekall-$PID

waitForRekall $rekallID

[ $output == 'python' ] && {
	mkdir -p python
	rm    -f python/pythonTest
}

echo "DCOP Python tests:"

echo "    pythonTest"
$dcop $rekallID rekall-part-form  'openObject(QString,QString,int)' 'MySQL' "PythonTest" 1 > /dev/null
$dcop $rekallID rekall-form/PythonTest 'executeScript(QString)' '
def eventFunc (form) :
    text = form.Button_All.__events__.onclick()
    return text
'   |
    sed 's/ @ 0x[a-zA-Z0-9]*\]/]/g' > $output/pythonTest

$dcop $rekallID rekall-form/PythonTest 'close(int)' 1 > /dev/null


kill	$PID
