# HG changeset patch # User Paul Boddie # Date 1446814474 -3600 # Node ID 8eedcceeb483dff76cc1dde83897e075a8fba36e # Parent 3dc39665e8ee036c3b7ece7cd58049df5d7862cb Fixed tools and test scripts that were not using overridden configuration settings. diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_handle.py --- a/tests/test_handle.py Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_handle.py Fri Nov 06 13:54:34 2015 +0100 @@ -94,19 +94,19 @@ if __name__ == "__main__": try: - action, store_dir, user = sys.argv[1:4] + action, store_dir, preferences_dir, user = sys.argv[1:5] if action == "counter": - start, end = sys.argv[4:6] - i = 6 + start, end = sys.argv[5:7] + i = 7 else: start, end = None, None - i = 4 + i = 5 uid, recurrenceid = (sys.argv[i:i+2] + [None] * 2)[:2] except ValueError: print >>sys.stderr, """\ -Need 'accept', 'counter' or 'decline', a store directory, user URI, any -counter-proposal datetimes (see below), plus the appropriate event UID and -RECURRENCE-ID (if a recurrence is involved). +Need 'accept', 'counter' or 'decline', a store directory, a preferences +directory, user URI, any counter-proposal datetimes (see below), plus the +appropriate event UID and RECURRENCE-ID (if a recurrence is involved). The RECURRENCE-ID must be in exactly the form employed by the store, not a different but equivalent representation. @@ -132,7 +132,7 @@ fragment = parse_object(sys.stdin, "utf-8") obj = Object(fragment) - handler = TestClient(obj, user, Messenger(), store) + handler = TestClient(obj, user, Messenger(), store, None, preferences_dir) response = handler.handle_request(action, start, end) if response: diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_person_invitation.sh --- a/tests/test_person_invitation.sh Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_person_invitation.sh Fri Nov 06 13:54:34 2015 +0100 @@ -21,10 +21,10 @@ export PYTHONPATH ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" -ACCEPT_ARGS="accept $STORE" +ACCEPT_ARGS="accept $STORE $PREFS" DECLINE_SCRIPT="$THIS_DIR/test_handle.py" -DECLINE_ARGS="decline $STORE" +DECLINE_ARGS="decline $STORE $PREFS" ERROR=err.tmp diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_person_invitation_add.sh --- a/tests/test_person_invitation_add.sh Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_person_invitation_add.sh Fri Nov 06 13:54:34 2015 +0100 @@ -23,10 +23,10 @@ export PYTHONPATH ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" -ACCEPT_ARGS="accept $STORE" +ACCEPT_ARGS="accept $STORE $PREFS" DECLINE_SCRIPT="$THIS_DIR/test_handle.py" -DECLINE_ARGS="decline $STORE" +DECLINE_ARGS="decline $STORE $PREFS" ERROR=err.tmp diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_person_invitation_counter.sh --- a/tests/test_person_invitation_counter.sh Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_person_invitation_counter.sh Fri Nov 06 13:54:34 2015 +0100 @@ -24,13 +24,13 @@ export PYTHONPATH ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" -ACCEPT_ARGS="accept $STORE" +ACCEPT_ARGS="accept $STORE $PREFS" COUNTER_SCRIPT="$THIS_DIR/test_handle.py" -COUNTER_ARGS="counter $STORE" +COUNTER_ARGS="counter $STORE $PREFS" DECLINE_SCRIPT="$THIS_DIR/test_handle.py" -DECLINE_ARGS="decline $STORE" +DECLINE_ARGS="decline $STORE $PREFS" ERROR=err.tmp diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_person_invitation_recurring.sh --- a/tests/test_person_invitation_recurring.sh Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_person_invitation_recurring.sh Fri Nov 06 13:54:34 2015 +0100 @@ -22,10 +22,10 @@ export PYTHONPATH ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" -ACCEPT_ARGS="accept $STORE" +ACCEPT_ARGS="accept $STORE $PREFS" DECLINE_SCRIPT="$THIS_DIR/test_handle.py" -DECLINE_ARGS="decline $STORE" +DECLINE_ARGS="decline $STORE $PREFS" ERROR=err.tmp diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_person_invitation_refresh.sh --- a/tests/test_person_invitation_refresh.sh Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_person_invitation_refresh.sh Fri Nov 06 13:54:34 2015 +0100 @@ -22,10 +22,10 @@ export PYTHONPATH ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" -ACCEPT_ARGS="accept $STORE" +ACCEPT_ARGS="accept $STORE $PREFS" DECLINE_SCRIPT="$THIS_DIR/test_handle.py" -DECLINE_ARGS="decline $STORE" +DECLINE_ARGS="decline $STORE $PREFS" ERROR=err.tmp diff -r 3dc39665e8ee -r 8eedcceeb483 tests/test_person_non_participation.sh --- a/tests/test_person_non_participation.sh Fri Nov 06 13:53:32 2015 +0100 +++ b/tests/test_person_non_participation.sh Fri Nov 06 13:54:34 2015 +0100 @@ -23,10 +23,10 @@ export PYTHONPATH ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" -ACCEPT_ARGS="accept $STORE" +ACCEPT_ARGS="accept $STORE $PREFS" DECLINE_SCRIPT="$THIS_DIR/test_handle.py" -DECLINE_ARGS="decline $STORE" +DECLINE_ARGS="decline $STORE $PREFS" ERROR=err.tmp diff -r 3dc39665e8ee -r 8eedcceeb483 tools/make_freebusy.py --- a/tools/make_freebusy.py Fri Nov 06 13:53:32 2015 +0100 +++ b/tools/make_freebusy.py Fri Nov 06 13:54:34 2015 +0100 @@ -38,17 +38,15 @@ from imiptools.data import get_window_end, Object from imiptools.dates import get_default_timezone, to_utc_datetime from imiptools.period import insert_period -from imiptools.profile import Preferences from imip_store import FileStore, FilePublisher -def make_freebusy(store, publisher, preferences, user, participant, - store_and_publish, include_needs_action, reset_updated_list, verbose): +def make_freebusy(client, participant, store_and_publish, include_needs_action, + reset_updated_list, verbose): """ - Using the given 'store', 'publisher' and 'preferences', make free/busy - details for the records of the given 'user', generating details for - 'participant' if not indicated as None; otherwise, generating free/busy - details concerning the given user. + Using the given 'client' representing a user, make free/busy details for the + records of the user, generating details for 'participant' if not indicated + as None; otherwise, generating free/busy details concerning the given user. If 'store_and_publish' is set, the stored details will be updated; otherwise, the details will be written to standard output. @@ -64,6 +62,11 @@ If 'verbose' is set, messages will be written to standard error. """ + user = client.user + store = client.get_store() + publisher = client.get_publisher() + preferences = client.get_preferences() + participant = participant or user tzid = preferences.get("TZID") or get_default_timezone() @@ -120,7 +123,7 @@ if user == participant: store.set_freebusy(user, fb) - if Client(user).is_sharing() and Client(user).is_publishing(): + if client.is_sharing() and client.is_publishing(): publisher.set_freebusy(user, fb) # Update the list of objects providing periods on future occasions. @@ -179,6 +182,12 @@ Specify -n to include objects with PARTSTAT of NEEDS-ACTION. Specify -r to inspect all objects, not just those expected to provide details. Specify -v for additional messages on standard error. + +General options: + +-S indicate the store directory location +-P indicate the publishing directory location +-p indicate the preferences directory location """ % split(sys.argv[0])[1] sys.exit(1) @@ -200,7 +209,6 @@ store = FileStore(store_dir) publisher = FilePublisher(publishing_dir) - preferences = Preferences(user, preferences_dir) # Obtain a list of users for processing. @@ -214,7 +222,8 @@ for user in users: if verbose: print >>sys.stderr, user - make_freebusy(store, publisher, preferences, user, participant, + make_freebusy( + Client(user, None, store, publisher, preferences_dir), participant, store_and_publish, include_needs_action, reset_updated_list, verbose) # vim: tabstop=4 expandtab shiftwidth=4