Skip to content

Commit 0f48e65

Browse files
committed
Streamline access tokens needed to run gcsfs and gdrive storage tests
1 parent 6450d41 commit 0f48e65

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

test/unit/files/_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def user_context_fixture(user_ftp_dir=None, role_names=None, group_names=None, i
5757
'dropbox|access_token': os.environ.get('GALAXY_TEST_DROPBOX_ACCESS_TOKEN'),
5858
'googledrive|access_token': os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_ACCESS_TOKEN'),
5959
'googledrive|refresh_token': os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_REFRESH_TOKEN'),
60-
'googledrive|client_id': os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_CLIENT_ID'),
61-
'googledrive|client_secret': os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_CLIENT_SECRET'),
6260
'googlecloudstorage|project': os.environ.get('GALAXY_TEST_GCS_PROJECT'),
63-
'googlecloudstorage|bucket_name': 'genomics-public-data',
61+
'googlecloudstorage|bucket_name': os.environ.get('GALAXY_TEST_GCS_BUCKET'),
62+
'googlecloudstorage|access_token': os.environ.get('GALAXY_TEST_GCS_ACCESS_TOKEN'),
63+
'googlecloudstorage|refresh_token': os.environ.get('GALAXY_TEST_GCS_REFRESH_TOKEN'),
6464
'onedata|provider_host': os.environ.get('GALAXY_TEST_ONEDATA_PROVIDER_HOST'),
6565
'onedata|access_token': os.environ.get('GALAXY_TEST_ONEDATA_ACCESS_TOKEN'),
6666
'basespace|client_id': os.environ.get('GALAXY_TEST_ONEDATA_CLIENT_ID'),

test/unit/files/googledrive_file_sources_conf.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@
33
doc: Test access to a Google drive.
44
token: ${user.preferences['googledrive|access_token']}
55
refresh_token: ${user.preferences['googledrive|refresh_token']}
6-
token_uri: "https://www.googleapis.com/oauth2/v4/token"
7-
client_id: ${user.preferences['googledrive|client_id']}
8-
client_secret: ${user.preferences['googledrive|client_secret']}

test/unit/files/test_basespace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
skip_if_no_basespace_access_token = pytest.mark.skipif(
1515
not os.environ.get('GALAXY_TEST_BASESPACE_CLIENT_ID')
16-
and not os.environ.get('GALAXY_TEST_BASESPACE_CLIENT_SECRET')
17-
and not os.environ.get('GALAXY_TEST_BASESPACE_ACCESS_TOKEN')
18-
and not os.environ.get('GALAXY_TEST_BASESPACE_TEST_FILE_PATH'),
16+
or not os.environ.get('GALAXY_TEST_BASESPACE_CLIENT_SECRET')
17+
or not os.environ.get('GALAXY_TEST_BASESPACE_ACCESS_TOKEN')
18+
or not os.environ.get('GALAXY_TEST_BASESPACE_TEST_FILE_PATH'),
1919
reason="GALAXY_TEST_BASESPACE_CLIENT_ID and related vars not set"
2020
)
2121

@@ -28,7 +28,7 @@ def test_file_source():
2828

2929
assert file_source_pair.path == "/"
3030
file_source = file_source_pair.file_source
31-
test_file = os.environ.get('GALAXY_TEST_BASESPACE_TEST_FILE_PATH')
31+
test_file = os.environ.get('GALAXY_TEST_BASESPACE_TEST_FILE_PATH', "")
3232
res = file_source.list(os.path.dirname(test_file), recursive=False, user_context=user_context)
3333
a_file = find(res, class_="File", name=os.path.basename(test_file))
3434
assert a_file

test/unit/files/test_gcsfs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
22

3+
import pytest
4+
35
from galaxy.files import ConfiguredFileSources, ConfiguredFileSourcesConfig
46
from ._util import (
57
assert_realizes_contains,
@@ -9,7 +11,16 @@
911
SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
1012
FILE_SOURCES_CONF = os.path.join(SCRIPT_DIRECTORY, "gcsfs_file_sources_conf.yml")
1113

14+
skip_if_no_gcs_access_token = pytest.mark.skipif(
15+
not os.environ.get('GALAXY_TEST_GCS_PROJECT')
16+
or not os.environ.get('GALAXY_TEST_GCS_BUCKET')
17+
or not os.environ.get('GALAXY_TEST_GCS_ACCESS_TOKEN')
18+
or not os.environ.get('GALAXY_TEST_GCS_REFRESH_TOKEN'),
19+
reason="GALAXY_TEST_GCS_ACCESS_TOKEN and related vars not set"
20+
)
21+
1222

23+
@skip_if_no_gcs_access_token
1324
def test_file_source():
1425
user_context = user_context_fixture()
1526
file_sources = _configured_file_sources()

test/unit/files/test_googledrive.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
skip_if_no_google_drive_access_token = pytest.mark.skipif(
1515
not os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_ACCESS_TOKEN')
16-
and not os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_REFRESH_TOKEN')
17-
and not os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_CLIENT_ID')
18-
and not os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_CLIENT_SECRET'),
16+
or not os.environ.get('GALAXY_TEST_GOOGLE_DRIVE_REFRESH_TOKEN'),
1917
reason="GALAXY_TEST_GOOGLE_DRIVE_ACCESS_TOKEN and related vars not set"
2018
)
2119

test/unit/files/test_onedata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
skip_if_no_onedata_access_token = pytest.mark.skipif(
1515
not os.environ.get('GALAXY_TEST_ONEDATA_PROVIDER_HOST')
16-
and not os.environ.get('GALAXY_TEST_ONEDATA_ACCESS_TOKEN'),
16+
or not os.environ.get('GALAXY_TEST_ONEDATA_ACCESS_TOKEN'),
1717
reason="GALAXY_TEST_ONEDATA_PROVIDER_HOST and GALAXY_TEST_ONEDATA_ACCESS_TOKEN not set"
1818
)
1919

0 commit comments

Comments
 (0)