diff --git a/.travis.yml b/.travis.yml index 692cbba1..6aabe579 100644 --- a/.travis.yml +++ b/.travis.yml @@ -247,9 +247,9 @@ script: - if [ "$e2e" = true ]; then $gam calendar $gam_user addevent summary "Travis test event" start $(date '+%FT%T.%N%:z' -d "now + 1 hour") end $(date '+%FT%T.%N%:z' -d "now + 2 hours") attendee $newgroup hangoutsmeet guestscanmodify true sendupdates all; fi - if [ "$e2e" = true ]; then $gam calendar $gam_user printevents after -0d; fi - if [ "$e2e" = true ]; then $gam create vaultmatter name "Travis matter $newbase" description "test matter" collaborators $newuser; fi -- if [ "$e2e" = true ]; then $gam create vaulthold matter "Travis $newbase" name "Travis hold $newbase" corpus mail accounts $newuser; fi +- if [ "$e2e" = true ]; then $gam create vaulthold matter "Travis matter $newbase" name "Travis hold $newbase" corpus mail accounts $newuser; fi - if [ "$e2e" = true ]; then $gam print vaultmatters; fi -- if [ "$e2e" = true ]; then $gam print vaultholds; fi +- if [ "$e2e" = true ]; then $gam print vaultholds matter "Travis matter $newbase; fi - if [ "$e2e" = true ]; then $gam create vaultexport matter "Travis matter $newbase" name "Travis export $newbase" corpus mail accounts $newuser; fi - if [ "$e2e" = true ]; then $gam print exports matter "Travis matter $newbase" | $gam csv - gam info export id:~~matterId~~ id:~~id~~; fi - if [ "$e2e" = true ]; then $gam printer register; fi diff --git a/src/gam.py b/src/gam.py index 80b884fc..5f8f878d 100755 --- a/src/gam.py +++ b/src/gam.py @@ -1109,7 +1109,7 @@ def showReport(): rep = buildGAPIObject('reports') report = sys.argv[2].lower() report = REPORT_CHOICE_MAP.get(report.replace('_', ''), report) - valid_apps = _getEnumValuesMinusUnspecified(rep._rootDesc['resources']['activities']['methods']['list']['parameters']['applicationName']['enum'])+['customer', 'user'] + valid_apps = gapi.get_enum_values_minus_unspecified(rep._rootDesc['resources']['activities']['methods']['list']['parameters']['applicationName']['enum'])+['customer', 'user'] if report not in valid_apps: controlflow.expected_argument_exit("report", ", ".join(sorted(valid_apps)), report) customerId = GC_Values[GC_CUSTOMER_ID] @@ -1556,13 +1556,13 @@ def getCourseAttribute(myarg, value, body, croom, function): elif myarg in ['owner', 'ownerid', 'teacher']: body['ownerId'] = normalizeEmailAddressOrUID(value) elif myarg in ['state', 'status']: - validStates = _getEnumValuesMinusUnspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum']) + validStates = gapi.get_enum_values_minus_unspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum']) body['courseState'] = _getValidatedState(value, validStates) else: controlflow.invalid_argument_exit(myarg, f"gam {function} course") def _getCourseStates(croom, value, courseStates): - validStates = _getEnumValuesMinusUnspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum']) + validStates = gapi.get_enum_values_minus_unspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum']) for state in value.replace(',', ' ').split(): courseStates.append(_getValidatedState(state, validStates)) @@ -7149,7 +7149,7 @@ def doCreateOrRotateServiceAccountKeys(iam=None, project_id=None, client_email=N myarg = sys.argv[i].lower().replace('_', '') if myarg == 'algorithm': body['keyAlgorithm'] = sys.argv[i+1].upper() - allowed_algorithms = _getEnumValuesMinusUnspecified(iam._rootDesc['schemas']['CreateServiceAccountKeyRequest']['properties']['keyAlgorithm']['enum']) + allowed_algorithms = gapi.get_enum_values_minus_unspecified(iam._rootDesc['schemas']['CreateServiceAccountKeyRequest']['properties']['keyAlgorithm']['enum']) if body['keyAlgorithm'] not in allowed_algorithms: controlflow.expected_argument_exit("algorithm", ", ".join(allowed_algorithms), body['keyAlgorithm']) local_key_size = 0 @@ -10033,7 +10033,7 @@ def doPrintShowAlertFeedback(): def doCreateAlertFeedback(): _, ac = buildAlertCenterGAPIObject(_getValueFromOAuth('email')) - valid_types = _getEnumValuesMinusUnspecified(ac._rootDesc['schemas']['AlertFeedback']['properties']['type']['enum']) + valid_types = gapi.get_enum_values_minus_unspecified(ac._rootDesc['schemas']['AlertFeedback']['properties']['type']['enum']) alertId = sys.argv[3] body = {'type': sys.argv[4].upper()} if body['type'] not in valid_types: diff --git a/src/gapi/calendar.py b/src/gapi/calendar.py index e2c972df..cc666b68 100644 --- a/src/gapi/calendar.py +++ b/src/gapi/calendar.py @@ -152,16 +152,16 @@ def printEvents(): showHiddenInvitations = True i += 1 elif myarg == 'after': - timeMin = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) + timeMin = utils.get_time_or_delta_from_now(sys.argv[i+1]) i += 2 elif myarg == 'before': - timeMax = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) + timeMax = utils.get_time_or_delta_from_now(sys.argv[i+1]) i += 2 elif myarg == 'timezone': timeZone = sys.argv[i+1] i += 2 elif myarg == 'updated': - updatedMin = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) + updatedMin = utils.get_time_or_delta_from_now(sys.argv[i+1]) i += 2 elif myarg == 'todrive': toDrive = True @@ -312,14 +312,14 @@ def getEventAttributes(i, cal, body, action): body['start'] = {'date': __main__.getYYYYMMDD(sys.argv[i+2])} i += 3 else: - body['start'] = {'dateTime': __main__.getTimeOrDeltaFromNow(sys.argv[i+1])} + body['start'] = {'dateTime': utils.get_time_or_delta_from_now(sys.argv[i+1])} i += 2 elif myarg == 'end': if sys.argv[i+1].lower() == 'allday': body['end'] = {'date': getYYYYMMDD(sys.argv[i+2])} i += 3 else: - body['end'] = {'dateTime': __main__.getTimeOrDeltaFromNow(sys.argv[i+1])} + body['end'] = {'dateTime': utils.get_time_or_delta_from_now(sys.argv[i+1])} i += 2 elif myarg == 'guestscantinviteothers': body['guestsCanInviteOthers'] = False @@ -457,10 +457,10 @@ def changeAttendees(users): do_it = False i += 1 elif myarg == 'start': - start_date = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) + start_date = utils.get_time_or_delta_from_now(sys.argv[i+1]) i += 2 elif myarg == 'end': - end_date = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) + end_date = utils.get_time_or_delta_from_now(sys.argv[i+1]) i += 2 elif myarg == 'allevents': allevents = True diff --git a/src/gapi/vault.py b/src/gapi/vault.py index 8007e335..503bb240 100644 --- a/src/gapi/vault.py +++ b/src/gapi/vault.py @@ -199,7 +199,7 @@ def getExportInfo(): def createHold(): v = buildGAPIObject() - allowed_corpuses = v._rootDesc['schemas']['Hold']['properties']['corpus']['enum'] + allowed_corpuses = gapi.get_enum_values_minus_unspecified(v._rootDesc['schemas']['Hold']['properties']['corpus']['enum']) body = {'query': {}} i = 3 query = None