def check_missing_generic(role, folder_base, generic_role_names, provider, constants, monkeypatch):
 assert (folder_base is not None)
 role_map = (constants['gmail_role_map'] if (provider == 'gmail') else constants['imap_role_map'])
 keys_to_remove = []
 for folder_name in role_map:
  if (role_map[folder_name] == role):
   keys_to_remove.append(folder_name)
 for key in keys_to_remove:
  del role_map[key]
 for role_alias in generic_role_names:
  folders = (folder_base + [('\\HasNoChildren', '/', role_alias)])
  client = (patch_gmail_client(monkeypatch, folders) if (provider == 'gmail') else patch_generic_client(monkeypatch, folders))
  raw_folders = client.folders()
  role_map[role_alias] = role
  generic_folder_checks(raw_folders, role_map, client, provider)
  del role_map[role_alias]

def check_missing_generic ( role , folder_base , generic_role_names , provider , constants , monkeypatch ) : assert ( folder_base is not None ) role_map = ( constants [ 'gmail_role_map' ] if ( provider == 'gmail' ) else constants [ 'imap_role_map' ] ) keys_to_remove = [ ] for folder_name in role_map : if ( role_map [ folder_name ] == role ) : keys_to_remove . append ( folder_name ) for key in keys_to_remove : del role_map [ key ] for role_alias in generic_role_names : folders = ( folder_base + [ ( '\\HasNoChildren' , '/' , role_alias ) ] ) client = ( patch_gmail_client ( monkeypatch , folders ) if ( provider == 'gmail' ) else patch_generic_client ( monkeypatch , folders ) ) raw_folders = client . folders ( ) role_map [ role_alias ] = role generic_folder_checks ( raw_folders , role_map , client , provider ) del role_map [ role_alias ]
check clients label every folder in generic_role_names as input role role: the role that the generic_role_names should be assigned folder_base: generic list of folders .