Skip to content

Commit

Permalink
feat(googlesheets2): first pass at passing token (#198)
Browse files Browse the repository at this point in the history
added test for codecov

fixed test
  • Loading branch information
testinnplayin committed Sep 2, 2020
1 parent 6472f60 commit c93591b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/google_sheets_2/test_google_sheets_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

import_path = 'toucan_connectors.google_sheets_2.google_sheets_2_connector'

python_version_is_older = helpers.check_py_version((3, 8))


@fixture
def con():
Expand Down Expand Up @@ -67,9 +65,8 @@ def test_get_form_with_secrets(mocker, con, ds):
connector=con,
current_config={'spreadsheet_id': '1SMnhnmBm-Tup3SfhS03McCf6S4pS2xqjI6CAXSSBpHU'},
)
print('result ', result)
expected_results = ['Foo', 'Bar', 'Baz']
if python_version_is_older:
if result.get('definitions'):
assert result['definitions']['sheet']['enum'] == expected_results
else:
assert result['properties']['sheet']['enum'] == expected_results
Expand All @@ -82,10 +79,10 @@ def test_get_form_no_secrets(mocker, con, ds):
connector=con,
current_config={'spreadsheet_id': '1SMnhnmBm-Tup3SfhS03McCf6S4pS2xqjI6CAXSSBpHU'},
)
if python_version_is_older:
assert not result.get('definitions')
else:
if result.get('properties'):
assert not result['properties']['sheet'].get('enum')
else:
assert not result.get('definitions')


def test_set_secrets(mocker, con):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def _run_fetch(self, url, access_token):
future = asyncio.ensure_future(self._get_data(url, access_token))
return loop.run_until_complete(future)

def set_secrets(self, secrets: Dict[str, str]):
"""Set the secrets from inside the main service."""
self.secrets = secrets

def _retrieve_data(self, data_source: GoogleSheets2DataSource) -> pd.DataFrame:
"""
Point of entry for data retrieval in the connector
Expand Down

0 comments on commit c93591b

Please sign in to comment.