summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/test_calendar-cli.sh47
-rwxr-xr-xtests/tests.sh4
2 files changed, 40 insertions, 11 deletions
diff --git a/tests/test_calendar-cli.sh b/tests/test_calendar-cli.sh
index be2717e..f986f12 100755
--- a/tests/test_calendar-cli.sh
+++ b/tests/test_calendar-cli.sh
@@ -1,29 +1,58 @@
#!/bin/bash
-########################################################################
-## RADICALE
-########################################################################
storage=$(mktemp -d)
+
+echo "########################################################################"
+echo "## RADICALE"
+echo "########################################################################"
python3 -m radicale --storage-filesystem-folder=$storage &
sleep 0.3
-jobs -l
radicale_pid=$(jobs -l | perl -ne '/^\[\d+\]\+\s+(\d+)\s+Running/ && print $1')
if [ -n "$radicale_pid" ]
then
echo "## Radicale now running on pid $radicale_pid"
calendar_cli="../calendar-cli --caldav-url=http://localhost:5232/ --caldav-user=testuser --calendar-url=/testuser/calendar-cli-test-calendar"
+ echo "## Creating a calendar"
$calendar_cli calendar create calendar-cli-test-calendar
+
+ ## crazy, now I get a 403 forbidden on the calendar create, but
+ ## the calendar is created. Without the statement above, I'll
+ ## just get 404 when running tests.
export calendar_cli
./tests.sh
kill $radicale_pid
- rm -rf $storage
+ sleep 0.3
else
echo "## Could not start up radicale (is it installed?). Will skip running tests towards radicale"
fi
-########################################################################
-## XANDIKOS
-########################################################################
-## TODO! work in progress
+echo "########################################################################"
+echo "## XANDIKOS"
+echo "########################################################################"
+echo "Not supported at the moment (xandikos dev decided to return a 500 telling that expand doesn't work when I prodded them that it didn't work. should maybe try to create a workaround)"
+exit 0
+xandikos_bin=$(which xandikos 2> /dev/null)
+if [ -n "$xandikos_bin" ]
+then
+ $xandikos_bin --defaults -d $storage &
+ sleep 0.5
+ xandikos_pid=$(jobs -l | perl -ne '/^\[\d+\]\+\s+(\d+)\s+Running/ && print $1')
+fi
+
+if [ -n "$xandikos_pid" ]
+then
+ echo "## Xandikos now running on pid $xandikos_pid"
+ calendar_cli="../calendar-cli --caldav-url=http://localhost:8080/ --caldav-user=user"
+ export calendar_cli
+ ./tests.sh
+ kill $xandikos_pid
+else
+ echo "## Could not start up xandikos (is it installed?). Will skip running tests towards xandikos"
+fi
+
+echo "########################################################################"
+echo "## cleanup"
+echo "########################################################################"
+rm -rf $storage
diff --git a/tests/tests.sh b/tests/tests.sh
index d496d8a..7a57f46 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -21,7 +21,7 @@ calendar_cli() {
[ -z "$output" ] || echo $output
}
-## CLEANUP from earlier failed test runs
+echo "## CLEANUP from earlier failed test runs"
for uid in $($calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=4 --event-template='{uid}') ; do calendar_cli calendar delete --event-uid=$uid ; done
calendar_cli todo --categories scripttest delete
@@ -30,7 +30,7 @@ calendar_cli todo --categories scripttest delete
## TEST CODE FOLLOWS
########################################################################
-## EVENTS
+echo "## EVENTS"
echo "## testing $calendar_cli"
echo "## this is a very simple test script without advanced error handling"