From 36fbbe2654d2f73a7583d9538787fd807b781b0e Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Mon, 18 Apr 2022 10:07:34 +0200 Subject: Work in progress on new cli (I was working on this several months ago - then I got interrupted, forgot to commit, never got time to look back) --- tests/test_calendar-cli.sh | 8 ++++++-- tests/tests.sh | 17 ++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/test_calendar-cli.sh b/tests/test_calendar-cli.sh index d1400e2..b3b3920 100755 --- a/tests/test_calendar-cli.sh +++ b/tests/test_calendar-cli.sh @@ -11,8 +11,8 @@ 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.py --caldav-url=http://localhost:5232/ --caldav-user=testuser --calendar-url=/testuser/calendar-cli-test-calendar" - kal="../cal.py --caldav-url=http://localhost:5232/ --caldav-user=testuser --calendar-url=/testuser/calendar-cli-test-calendar" + calendar_cli="../calendar-cli.py --caldav-url=http://localhost:5232/ --caldav-pass=password1 --caldav-user=testuser --calendar-url=/testuser/calendar-cli-test-calendar" + kal="../cal.py --caldav-password=password1 --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 @@ -21,7 +21,11 @@ then ## just get 404 when running tests. export calendar_cli export kal + echo "press enter to run tests" + read foo ./tests.sh + echo "press enter to take down test server" + read foo kill $radicale_pid sleep 0.3 else diff --git a/tests/tests.sh b/tests/tests.sh index b93d037..1370578 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -46,19 +46,19 @@ echo "## OK: Added the event, uid is $uid" echo "## Taking out the agenda for 2010-10-09 + four days" calendar_cli calendar agenda --from-time=2010-10-09 --agenda-days=4 --event-template='{description} {location}' -echo $output | { grep -q 'this is a test calendar event Москва' && echo "## OK: found the event" ; } || echo "## FAIL: didn't find the event" +echo $output | { grep -q 'this is a test calendar event Москва' && echo "## OK: found the event" ; } || error "didn't find the event" echo "## Taking out the agenda for 2010-10-10, with uid" calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=1 --event-template='{dtstart} {uid}' -echo $output | { grep -q $uid2 && echo "## OK: found the UID" ; } || echo "## FAIL: didn't find the UID" +echo $output | { grep -q $uid2 && echo "## OK: found the UID" ; } || error "didn't find the UID" echo "## Deleting events with uid $uid $uid1 $uid2" calendar_cli calendar delete --event-uid=$uid calendar_cli calendar delete --event-uid=$uid2 -calendar_cli calendar delete --event-uid=$uid3 +kal select --uid=$uid3 delete echo "## Searching again for the deleted event" -calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=1 -echo $output | { grep -q 'testing testing' && echo "## FAIL: still found the event" ; } || echo "## OK: didn't find the event" +calendar_cli calendar agenda --from-time=2010-10-10 --agenda-days=3 +echo $output | { grep -q 'testing testing' && error "still found the event" ; } || echo "## OK: didn't find the event" echo "## Adding a full day event" calendar_cli calendar add --whole-day '2010-10-10+4d' 'whole day testing' @@ -82,6 +82,7 @@ calendar_cli calendar delete --event-uid=$uid echo "## Same, using kal add ics" kal add ical --ical-file=$tmpfile + rm $tmpfile calendar_cli --icalendar calendar agenda --from-time=2010-10-13 --agenda-days=1 echo "$output" | grep -q "whole day" || error "could not find the event" @@ -160,15 +161,17 @@ echo "## TODOS / TASK LISTS" echo "## Attempting to add a task with category 'scripttest'" calendar_cli todo add --set-categories scripttest "edit this task" -echo test uidtodo1=$(echo $output | perl -ne '/uid=(.*)$/ && print $1') +kal add --set-categories scripttest todo "edit this task2" +uidtodo2=$(echo $output | perl -ne '/uid=(.*)$/ && print $1') echo "## Listing out all tasks with category set to 'scripttest'" calendar_cli todo --categories scripttest list -[ $(echo "$output" | wc -l) == 1 ] && echo "## OK: found the todo item we just added and nothing more" +[ $(echo "$output" | wc -l) == 2 ] || error "We found more or less or none of the two todo items we just added" echo "## Editing the task" calendar_cli todo --categories scripttest edit --set-summary "editing" --add-categories "scripttest2" +#kal select --todo --categories scripttest edit --add-categories "scripttest3" echo "## Verifying that the edits got through" calendar_cli todo --categories scripttest list -- cgit v1.2.3