diff options
author | Tobias Brox <tobias@redpill-linpro.com> | 2022-05-29 16:20:39 +0200 |
---|---|---|
committer | Tobias Brox <tobias@redpill-linpro.com> | 2022-05-29 16:20:39 +0200 |
commit | fd834cd17933bad5567f1315ddc800145081dcd6 (patch) | |
tree | 49692213cc5e9b408ee2cb75bd8b1f622d058746 | |
parent | 36fbbe2654d2f73a7583d9538787fd807b781b0e (diff) | |
download | calendar-cli-fd834cd17933bad5567f1315ddc800145081dcd6.zip |
some work on the testing script. (This should be cleaned up and made more readable and modular ... but how?)
-rw-r--r-- | NEW_CLI.md | 2 | ||||
-rwxr-xr-x | cal.py | 1 | ||||
-rw-r--r-- | tests/_setup_alias | 1 | ||||
-rwxr-xr-x | tests/test_calendar-cli.sh | 19 | ||||
-rwxr-xr-x | tests/tests.sh | 24 |
5 files changed, 42 insertions, 5 deletions
@@ -1,3 +1,5 @@ +I'm currently working on a cal.py aka kal that eventually will replace calendar-cli.py + ## General thoughts * calendar-cli should be a simple command line wrapper over existing python libraries. It should not contain a lot of logic besides parsing command line options and arguments. Logic that may be useful for python programmers should be pushed to other libraries, like the caldav-library, or be split into a new library. @@ -67,6 +67,7 @@ def cli(ctx, **kwargs): CalDAV Command Line Interface, in development. This command will eventually replace calendar-cli. + It's not ready for consumption. Only use if you want to contribute/test. """ ## The cli function will prepare a context object, a dict containing the ## caldav_client, principal and calendar diff --git a/tests/_setup_alias b/tests/_setup_alias index bfa34f0..0f2c6de 100644 --- a/tests/_setup_alias +++ b/tests/_setup_alias @@ -1,3 +1,4 @@ +set -o pipefail outfile=$(mktemp) error() { diff --git a/tests/test_calendar-cli.sh b/tests/test_calendar-cli.sh index b3b3920..b45d596 100755 --- a/tests/test_calendar-cli.sh +++ b/tests/test_calendar-cli.sh @@ -2,6 +2,11 @@ storage=$(mktemp -d) +echo "This script will attempt to set up a Radicale server and a Xandikos server and run the test code towards those two servers" +echo "The test code itself is found in tests.sh" + +export RUNTESTSNOPAUSE="foo" + echo "########################################################################" echo "## RADICALE" echo "########################################################################" @@ -21,11 +26,17 @@ then ## just get 404 when running tests. export calendar_cli export kal - echo "press enter to run tests" - read foo + if [ -n "$DEBUG" ] + then + echo "press enter to run tests" + read foo + fi ./tests.sh - echo "press enter to take down test server" - read foo + if [ -n "$DEBUG" ] + then + echo "press enter to take down test server" + read foo + fi kill $radicale_pid sleep 0.3 else diff --git a/tests/tests.sh b/tests/tests.sh index 1370578..bd1fbfb 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -12,7 +12,28 @@ do [ -f $setup ] && source $setup done -echo "## CLEANUP from earlier failed test runs" +if [ -z "$RUNTESTSNOPAUSE" ] +then + echo "tests.sh" + echo + echo "Generally, tests.sh should only be run directly if you know what you are doing" + echo "You may want to use test_calendar-cli.sh instead" + echo + echo "This script will use the following commands to access a calendar server:" + echo + echo "$calendar_cli" + echo "$kal" + echo + echo "This may work if you have configured a calendar server." + echo "The tests will add and delete events and tasks." + echo "Content from 2010-10 may be deleted" + echo + echo "Press enter or ctrl-C" + read foo +fi + + +echo "## CLEANUP from earlier failed test runs, if any" QUIET=true for uid in $($calendar_cli calendar agenda --from-time=2010-10-09 --agenda-days=5 --event-template='{uid}') ; do calendar_cli calendar delete --event-uid=$uid ; done @@ -55,6 +76,7 @@ echo $output | { grep -q $uid2 && echo "## OK: found the UID" ; } || error "didn 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=3 |