Example #1
0
def drive_exists():
    if file_exists(project.task['auth'], project.task['drive']['file']):
        if project.task.get('delete', False):
            file_delete(project.task['auth'], project.task['drive']['file'])
        print('PASSED')
    else:
        print('FAILED')
Example #2
0
def drive_exists():
    if file_exists(project.task['auth'], project.task['drive']['file']):
        if project.task.get('delete', False):
            file_delete(project.task['auth'], project.task['drive']['file'])
        test_passed()
    else:
        test_failed()
Example #3
0
def drive():
  if project.verbose: print 'Drive'

  if 'delete' in project.task:
    if project.verbose: print 'Drive Delete', project.task['delete']
    file_delete(project.task['auth'], project.task['delete'])

  if 'copy' in project.task:
    if project.verbose: print 'Drive Copy', project.task['copy']['source'], project.task['copy']['destination']
    file_copy(project.task['auth'], project.task['copy']['source'], project.task['copy']['destination'])
Example #4
0
def drive(config, task):
    if config.verbose:
        print('Drive')

    if 'delete' in task:
        if config.verbose:
            print('Drive Delete', task['delete'])
        file_delete(config, task['auth'], task['delete'])

    if 'copy' in task:
        if config.verbose:
            print('Drive Copy', task['copy']['source'],
                  task['copy']['destination'])
        file_copy(config, task['auth'], task['copy']['source'],
                  task['copy']['destination'])
Example #5
0
def sheets_tab_delete(auth, sheet_url_or_name, sheet_tab):
  if project.verbose: print 'SHEETS DELETE', sheet_url_or_name, sheet_tab

  spreadsheet = sheets_get(auth, sheet_url_or_name)
  if spreadsheet:
    if len(spreadsheet['sheets']) == 1 and  spreadsheet['sheets'][0]['properties']['title'] == sheet_tab:
      file_delete(auth, spreadsheet['properties']['title'], parent = None)
    else:
      sheet_id, tab_id = sheets_tab_id(auth, sheet_url_or_name, sheet_tab)
      # add check to see if only tab, then delete whole sheet
      if tab_id is not None:
        sheets_batch_update(auth, sheet_url_or_name, {
          "requests":[{
            "deleteSheet": {
              "sheetId": tab_id,
            }
          }]
        }) 
Example #6
0
def sheets_tab_delete(config, auth, sheet_url_or_name, sheet_tab):
    if config.verbose:
        print('SHEETS DELETE', sheet_url_or_name, sheet_tab)

    spreadsheet = sheets_get(config, auth, sheet_url_or_name)
    if spreadsheet:
        if len(spreadsheet['sheets']) == 1 and spreadsheet['sheets'][0][
                'properties']['title'] == sheet_tab:
            file_delete(config,
                        auth,
                        spreadsheet['properties']['title'],
                        parent=None)
        else:
            sheet_id, tab_id = sheets_tab_id(config, auth, sheet_url_or_name,
                                             sheet_tab)
            # add check to see if only tab, then delete whole sheet
            if tab_id is not None:
                sheets_batch_update(
                    auth, sheet_url_or_name,
                    {'requests': [{
                        'deleteSheet': {
                            'sheetId': tab_id,
                        }
                    }]})