# Path: montage/loaders.py
# def get_entries_from_gsheet(raw_url, source='local'):
#     #TODO: add support for sheet tabs
#     doc_id = parse_doc_id(raw_url)
#     url = GSHEET_URL % doc_id
#     resp = requests.get(url)
# 
#     if not 'text/csv' in resp.headers['content-type']:
#         raise ValueError('cannot load Google Sheet "%s" (is link sharing on?)' % raw_url)
# 
#     try:
#         ret, warnings = load_full_csv(StringIO.StringIO(resp.content), source=source)
#     except ValueError:
#         try:
#             ret, warnings = load_partial_csv(resp)  # TODO: load_partial_csv expects a dictreader, did this ever work?
#         except ValueError:
#             file_names = [fn.strip('\"') for fn in resp.content.split('\n')]
#             file_names_obj = StringIO.StringIO('\n'.join(file_names))
#             ret, warnings = load_name_list(file_names_obj, source=source)
# 
#     return ret, warnings


from pytest import raises
from montage.loaders import get_entries_from_gsheet
# -*- coding: utf-8 -*-

from __future__ import print_function



RESULTS = 'https://docs.google.com/spreadsheets/d/1RDlpT23SV_JB1mIz0OA-iuc3MNdNVLbaK_LtWAC7vzg/edit?usp=sharing'
FILENAME_LIST = 'https://docs.google.com/spreadsheets/d/1Nqj-JsX3L5qLp5ITTAcAFYouglbs5OpnFwP6zSFpa0M/edit?usp=sharing'
GENERIC_CSV = 'https://docs.google.com/spreadsheets/d/1WzHFg_bhvNthRMwNmxnk010KJ8fwuyCrby29MvHUzH8/edit#gid=550467819'
FORBIDDEN_SHEET = 'https://docs.google.com/spreadsheets/d/1tza92brMKkZBTykw3iS6X9ij1D4_kvIYAiUlq1Yi7Fs/edit'

def test_load_results():

# Path: montage/loaders.py
# def get_entries_from_gsheet(raw_url, source='local'):
#     #TODO: add support for sheet tabs
#     doc_id = parse_doc_id(raw_url)
#     url = GSHEET_URL % doc_id
#     resp = requests.get(url)
# 
#     if not 'text/csv' in resp.headers['content-type']:
#         raise ValueError('cannot load Google Sheet "%s" (is link sharing on?)' % raw_url)
# 
#     try:
#         ret, warnings = load_full_csv(StringIO.StringIO(resp.content), source=source)
#     except ValueError:
#         try:
#             ret, warnings = load_partial_csv(resp)  # TODO: load_partial_csv expects a dictreader, did this ever work?
#         except ValueError:
#             file_names = [fn.strip('\"') for fn in resp.content.split('\n')]
#             file_names_obj = StringIO.StringIO('\n'.join(file_names))
#             ret, warnings = load_name_list(file_names_obj, source=source)
# 
#     return ret, warnings


# Path: montage/tests/test_loaders.py
from pytest import raises
from montage.loaders import get_entries_from_gsheet

# -*- coding: utf-8 -*-

from __future__ import print_function



RESULTS = 'https://docs.google.com/spreadsheets/d/1RDlpT23SV_JB1mIz0OA-iuc3MNdNVLbaK_LtWAC7vzg/edit?usp=sharing'
FILENAME_LIST = 'https://docs.google.com/spreadsheets/d/1Nqj-JsX3L5qLp5ITTAcAFYouglbs5OpnFwP6zSFpa0M/edit?usp=sharing'
GENERIC_CSV = 'https://docs.google.com/spreadsheets/d/1WzHFg_bhvNthRMwNmxnk010KJ8fwuyCrby29MvHUzH8/edit#gid=550467819'
FORBIDDEN_SHEET = 'https://docs.google.com/spreadsheets/d/1tza92brMKkZBTykw3iS6X9ij1D4_kvIYAiUlq1Yi7Fs/edit'

def test_load_results():

    imgs, warnings = get_entries_from_gsheet(RESULTS, source='remote')