More fixes

This commit is contained in:
Jay Lee
2020-03-09 04:49:44 -04:00
parent c23cfd121e
commit a9917432d4
4 changed files with 15 additions and 15 deletions

View File

@@ -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 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 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 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 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 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 print exports matter "Travis matter $newbase" | $gam csv - gam info export id:~~matterId~~ id:~~id~~; fi
- if [ "$e2e" = true ]; then $gam printer register; fi - if [ "$e2e" = true ]; then $gam printer register; fi

View File

@@ -1109,7 +1109,7 @@ def showReport():
rep = buildGAPIObject('reports') rep = buildGAPIObject('reports')
report = sys.argv[2].lower() report = sys.argv[2].lower()
report = REPORT_CHOICE_MAP.get(report.replace('_', ''), report) 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: if report not in valid_apps:
controlflow.expected_argument_exit("report", ", ".join(sorted(valid_apps)), report) controlflow.expected_argument_exit("report", ", ".join(sorted(valid_apps)), report)
customerId = GC_Values[GC_CUSTOMER_ID] customerId = GC_Values[GC_CUSTOMER_ID]
@@ -1556,13 +1556,13 @@ def getCourseAttribute(myarg, value, body, croom, function):
elif myarg in ['owner', 'ownerid', 'teacher']: elif myarg in ['owner', 'ownerid', 'teacher']:
body['ownerId'] = normalizeEmailAddressOrUID(value) body['ownerId'] = normalizeEmailAddressOrUID(value)
elif myarg in ['state', 'status']: 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) body['courseState'] = _getValidatedState(value, validStates)
else: else:
controlflow.invalid_argument_exit(myarg, f"gam {function} course") controlflow.invalid_argument_exit(myarg, f"gam {function} course")
def _getCourseStates(croom, value, courseStates): 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(): for state in value.replace(',', ' ').split():
courseStates.append(_getValidatedState(state, validStates)) 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('_', '') myarg = sys.argv[i].lower().replace('_', '')
if myarg == 'algorithm': if myarg == 'algorithm':
body['keyAlgorithm'] = sys.argv[i+1].upper() 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: if body['keyAlgorithm'] not in allowed_algorithms:
controlflow.expected_argument_exit("algorithm", ", ".join(allowed_algorithms), body['keyAlgorithm']) controlflow.expected_argument_exit("algorithm", ", ".join(allowed_algorithms), body['keyAlgorithm'])
local_key_size = 0 local_key_size = 0
@@ -10033,7 +10033,7 @@ def doPrintShowAlertFeedback():
def doCreateAlertFeedback(): def doCreateAlertFeedback():
_, ac = buildAlertCenterGAPIObject(_getValueFromOAuth('email')) _, 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] alertId = sys.argv[3]
body = {'type': sys.argv[4].upper()} body = {'type': sys.argv[4].upper()}
if body['type'] not in valid_types: if body['type'] not in valid_types:

View File

@@ -152,16 +152,16 @@ def printEvents():
showHiddenInvitations = True showHiddenInvitations = True
i += 1 i += 1
elif myarg == 'after': elif myarg == 'after':
timeMin = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) timeMin = utils.get_time_or_delta_from_now(sys.argv[i+1])
i += 2 i += 2
elif myarg == 'before': elif myarg == 'before':
timeMax = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) timeMax = utils.get_time_or_delta_from_now(sys.argv[i+1])
i += 2 i += 2
elif myarg == 'timezone': elif myarg == 'timezone':
timeZone = sys.argv[i+1] timeZone = sys.argv[i+1]
i += 2 i += 2
elif myarg == 'updated': elif myarg == 'updated':
updatedMin = __main__.getTimeOrDeltaFromNow(sys.argv[i+1]) updatedMin = utils.get_time_or_delta_from_now(sys.argv[i+1])
i += 2 i += 2
elif myarg == 'todrive': elif myarg == 'todrive':
toDrive = True toDrive = True
@@ -312,14 +312,14 @@ def getEventAttributes(i, cal, body, action):
body['start'] = {'date': __main__.getYYYYMMDD(sys.argv[i+2])} body['start'] = {'date': __main__.getYYYYMMDD(sys.argv[i+2])}
i += 3 i += 3
else: 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 i += 2
elif myarg == 'end': elif myarg == 'end':
if sys.argv[i+1].lower() == 'allday': if sys.argv[i+1].lower() == 'allday':
body['end'] = {'date': getYYYYMMDD(sys.argv[i+2])} body['end'] = {'date': getYYYYMMDD(sys.argv[i+2])}
i += 3 i += 3
else: 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 i += 2
elif myarg == 'guestscantinviteothers': elif myarg == 'guestscantinviteothers':
body['guestsCanInviteOthers'] = False body['guestsCanInviteOthers'] = False
@@ -457,10 +457,10 @@ def changeAttendees(users):
do_it = False do_it = False
i += 1 i += 1
elif myarg == 'start': 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 i += 2
elif myarg == 'end': 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 i += 2
elif myarg == 'allevents': elif myarg == 'allevents':
allevents = True allevents = True

View File

@@ -199,7 +199,7 @@ def getExportInfo():
def createHold(): def createHold():
v = buildGAPIObject() 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': {}} body = {'query': {}}
i = 3 i = 3
query = None query = None