From a27c02e4a0fd654f6a23b77d51378c15362b64aa Mon Sep 17 00:00:00 2001 From: Aaron Kanzer Date: Wed, 31 Jan 2024 17:25:03 -0500 Subject: [PATCH 1/2] More test fixes for patching in test suite --- .../data/update_dandiset_from_doi/biorxiv.json | 2 +- .../data/update_dandiset_from_doi/elife.json | 2 +- .../update_dandiset_from_doi/jneurosci.json | 2 +- .../data/update_dandiset_from_doi/nature.json | 2 +- lincbrain/cli/tests/test_download.py | 18 +++++++++--------- lincbrain/cli/tests/test_move.py | 4 ++-- lincbrain/support/digests.py | 2 +- lincbrain/tests/test_dandiapi.py | 14 +++++++------- lincbrain/tests/test_download.py | 10 +++++----- lincbrain/tests/test_keyring.py | 8 ++++---- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json index eb6a40f38..4788daeb2 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Aguillon-Rodriguez, Valeria; Angelaki, Dora E.; Bayer, Hannah M.; Bonacchi, Niccol\u00f2; Carandini, Matteo; Cazettes, Fanny; Chapuis, Gaelle A.; Churchland, Anne K.; Dan, Yang; Dewitt, Eric E. J.; Faulkner, Mayo; Forrest, Hamish; Haetzel, Laura M.; Hausser, Michael; Hofer, Sonja B.; Hu, Fei; Khanal, Anup; Krasniak, Christopher S.; Laranjeira, In\u00eas; Mainen, Zachary F.; Meijer, Guido T.; Miska, Nathaniel J.; Mrsic-Flogel, Thomas D.; Murakami, Masayoshi; Noel, Jean-Paul; Pan-Vazquez, Alejandro; Rossant, Cyrille; Sanders, Joshua I.; Socha, Karolina Z.; Terry, Rebecca; Urai, Anne E.; Vergara, Hernando M.; Wells, Miles J.; Wilson, Christian J.; Witten, Ilana B.; Wool, Lauren E.; Zador, Anthony (2023) Standardized and reproducible measurement of decision-making in mice (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000001/draft", + "citation": "Aguillon-Rodriguez, Valeria; Angelaki, Dora E.; Bayer, Hannah M.; Bonacchi, Niccol\u00f2; Carandini, Matteo; Cazettes, Fanny; Chapuis, Gaelle A.; Churchland, Anne K.; Dan, Yang; Dewitt, Eric E. J.; Faulkner, Mayo; Forrest, Hamish; Haetzel, Laura M.; Hausser, Michael; Hofer, Sonja B.; Hu, Fei; Khanal, Anup; Krasniak, Christopher S.; Laranjeira, In\u00eas; Mainen, Zachary F.; Meijer, Guido T.; Miska, Nathaniel J.; Mrsic-Flogel, Thomas D.; Murakami, Masayoshi; Noel, Jean-Paul; Pan-Vazquez, Alejandro; Rossant, Cyrille; Sanders, Joshua I.; Socha, Karolina Z.; Terry, Rebecca; Urai, Anne E.; Vergara, Hernando M.; Wells, Miles J.; Wilson, Christian J.; Witten, Ilana B.; Wool, Lauren E.; Zador, Anthony (2024) Standardized and reproducible measurement of decision-making in mice (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000001/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000001", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json index 7008fa0ab..c46657ef2 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Chowdhury, Raeed H; Glaser, Joshua I; Miller, Lee E (2023) Area 2 of primary somatosensory cortex encodes kinematics of the whole arm (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000004/draft", + "citation": "Chowdhury, Raeed H; Glaser, Joshua I; Miller, Lee E (2024) Area 2 of primary somatosensory cortex encodes kinematics of the whole arm (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000004/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000004", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json index ebed2dcaf..05a80bcbb 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Ito, Makoto; Doya, Kenji (2023) Validation of Decision-Making Models and Analysis of Decision Variables in the Rat Basal Ganglia (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000002/draft", + "citation": "Ito, Makoto; Doya, Kenji (2024) Validation of Decision-Making Models and Analysis of Decision Variables in the Rat Basal Ganglia (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000002/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000002", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json index 17f456374..abdadf0fe 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Sit, Kevin K.; Goard, Michael J. (2023) Coregistration of heading to visual cues in retrosplenial cortex (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000005/draft", + "citation": "Sit, Kevin K.; Goard, Michael J. (2024) Coregistration of heading to visual cues in retrosplenial cortex (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000005/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000005", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/test_download.py b/lincbrain/cli/tests/test_download.py index 0a8131cff..fc5915ede 100644 --- a/lincbrain/cli/tests/test_download.py +++ b/lincbrain/cli/tests/test_download.py @@ -11,7 +11,7 @@ def test_download_defaults(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -29,7 +29,7 @@ def test_download_defaults(mocker): def test_download_all_types(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "all"]) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -47,7 +47,7 @@ def test_download_all_types(mocker): def test_download_metadata_only(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "dandiset.yaml"]) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -65,7 +65,7 @@ def test_download_metadata_only(mocker): def test_download_assets_only(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "assets"]) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -83,7 +83,7 @@ def test_download_assets_only(mocker): def test_download_bad_type(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "foo"], standalone_mode=False) assert r.exit_code != 0 assert isinstance(r.exception, click.UsageError) @@ -95,7 +95,7 @@ def test_download_bad_type(mocker): def test_download_gui_instance_in_dandiset(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") runner = CliRunner() with runner.isolated_filesystem(): Path(dandiset_metadata_file).write_text("identifier: '123456'\n") @@ -120,7 +120,7 @@ def test_download_gui_instance_in_dandiset(mocker): reason="this instance now has GUI URL", ) def test_download_api_instance_in_dandiset(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") runner = CliRunner() with runner.isolated_filesystem(): Path(dandiset_metadata_file).write_text("identifier: '123456'\n") @@ -141,7 +141,7 @@ def test_download_api_instance_in_dandiset(mocker): def test_download_url_instance_match(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke( download, [ @@ -166,7 +166,7 @@ def test_download_url_instance_match(mocker): def test_download_url_instance_conflict(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke( download, ["-i", "dandi", "http://localhost:8000/api/dandisets/123456/"], diff --git a/lincbrain/cli/tests/test_move.py b/lincbrain/cli/tests/test_move.py index 9eca9545a..e0fae0fe3 100644 --- a/lincbrain/cli/tests/test_move.py +++ b/lincbrain/cli/tests/test_move.py @@ -76,14 +76,14 @@ def test_move_command( mocker: MockerFixture, cmdline: list[str], srcs: list[str], kwargs: dict[str, Any] ) -> None: - mock_move = mocker.patch("dandi.move.move") + mock_move = mocker.patch("lincbrain.move.move") r = CliRunner().invoke(move, cmdline) assert r.exit_code == 0 mock_move.assert_called_once_with(*srcs, **kwargs) def test_move_command_too_few_paths(mocker: MockerFixture) -> None: - mock_move = mocker.patch("dandi.move.move") + mock_move = mocker.patch("lincbrain.move.move") r = CliRunner().invoke(move, ["foo"], standalone_mode=False) assert r.exit_code != 0 # This is a ClickException when map_to_click_exceptions is in effect and a diff --git a/lincbrain/support/digests.py b/lincbrain/support/digests.py index 1748ad5cd..1edb568be 100644 --- a/lincbrain/support/digests.py +++ b/lincbrain/support/digests.py @@ -28,7 +28,7 @@ from .threaded_walk import threaded_walk from ..utils import Hasher, exclude_from_zarr -lgr = logging.getLogger("dandi.support.digests") +lgr = logging.getLogger("lincbrain.support.digests") @dataclass diff --git a/lincbrain/tests/test_dandiapi.py b/lincbrain/tests/test_dandiapi.py index 0aa9e8170..6c3f5f8f8 100644 --- a/lincbrain/tests/test_dandiapi.py +++ b/lincbrain/tests/test_dandiapi.py @@ -123,11 +123,11 @@ def test_authenticate_bad_key_good_key_input( backend_mock = mocker.Mock(spec=["set_password"]) keyring_lookup_mock = mocker.patch( - "dandi.dandiapi.keyring_lookup", return_value=(backend_mock, None) + "lincbrain.dandiapi.keyring_lookup", return_value=(backend_mock, None) ) - input_mock = mocker.patch("dandi.dandiapi.input", side_effect=[bad_key, good_key]) + input_mock = mocker.patch("lincbrain.dandiapi.input", side_effect=[bad_key, good_key]) is_interactive_mock = mocker.patch( - "dandi.dandiapi.is_interactive", return_value=True + "lincbrain.dandiapi.is_interactive", return_value=True ) confirm_mock = mocker.patch("click.confirm", return_value=True) @@ -156,7 +156,7 @@ def test_authenticate_good_key_keyring( backend_mock = mocker.Mock(spec=["set_password"]) keyring_lookup_mock = mocker.patch( - "dandi.dandiapi.keyring_lookup", return_value=(backend_mock, good_key) + "lincbrain.dandiapi.keyring_lookup", return_value=(backend_mock, good_key) ) input_spy = mocker.spy(builtins, "input") is_interactive_spy = mocker.spy(dandiapi, "is_interactive") @@ -186,11 +186,11 @@ def test_authenticate_bad_key_keyring_good_key_input( backend_mock = mocker.Mock(spec=["set_password"]) keyring_lookup_mock = mocker.patch( - "dandi.dandiapi.keyring_lookup", return_value=(backend_mock, bad_key) + "lincbrain.dandiapi.keyring_lookup", return_value=(backend_mock, bad_key) ) - input_mock = mocker.patch("dandi.dandiapi.input", return_value=good_key) + input_mock = mocker.patch("lincbrain.dandiapi.input", return_value=good_key) is_interactive_mock = mocker.patch( - "dandi.dandiapi.is_interactive", return_value=True + "lincbrain.dandiapi.is_interactive", return_value=True ) confirm_mock = mocker.patch("click.confirm", return_value=True) diff --git a/lincbrain/tests/test_download.py b/lincbrain/tests/test_download.py index c5badf85f..041901538 100644 --- a/lincbrain/tests/test_download.py +++ b/lincbrain/tests/test_download.py @@ -218,7 +218,7 @@ def test_download_sync( dspath = tmp_path / text_dandiset.dandiset_id os.rename(text_dandiset.dspath, dspath) confirm_mock = mocker.patch( - "dandi.download.abbrev_prompt", return_value="yes" if confirm else "no" + "lincbrain.download.abbrev_prompt", return_value="yes" if confirm else "no" ) download( f"dandi://{text_dandiset.api.instance_id}/{text_dandiset.dandiset_id}", @@ -238,7 +238,7 @@ def test_download_sync_folder( ) -> None: text_dandiset.dandiset.get_asset_by_path("file.txt").delete() text_dandiset.dandiset.get_asset_by_path("subdir2/banana.txt").delete() - confirm_mock = mocker.patch("dandi.download.abbrev_prompt", return_value="yes") + confirm_mock = mocker.patch("lincbrain.download.abbrev_prompt", return_value="yes") download( f"dandi://{text_dandiset.api.instance_id}/{text_dandiset.dandiset_id}/subdir2/", text_dandiset.dspath, @@ -259,7 +259,7 @@ def test_download_sync_list( text_dandiset.dandiset.get_asset_by_path("file.txt").delete() dspath = tmp_path / text_dandiset.dandiset_id os.rename(text_dandiset.dspath, dspath) - input_mock = mocker.patch("dandi.utils.input", side_effect=["list", "yes"]) + input_mock = mocker.patch("lincbrain.utils.input", side_effect=["list", "yes"]) download( f"dandi://{text_dandiset.api.instance_id}/{text_dandiset.dandiset_id}", tmp_path, @@ -280,7 +280,7 @@ def test_download_sync_zarr( zarr_dandiset.dandiset.get_asset_by_path("sample.zarr").delete() dspath = tmp_path / zarr_dandiset.dandiset_id os.rename(zarr_dandiset.dspath, dspath) - confirm_mock = mocker.patch("dandi.download.abbrev_prompt", return_value="yes") + confirm_mock = mocker.patch("lincbrain.download.abbrev_prompt", return_value="yes") download( zarr_dandiset.dandiset.version_api_url, tmp_path, @@ -856,7 +856,7 @@ def test_download_sync_glob( ) -> None: text_dandiset.dandiset.get_asset_by_path("file.txt").delete() text_dandiset.dandiset.get_asset_by_path("subdir2/banana.txt").delete() - confirm_mock = mocker.patch("dandi.download.abbrev_prompt", return_value="yes") + confirm_mock = mocker.patch("lincbrain.download.abbrev_prompt", return_value="yes") download( f"{text_dandiset.dandiset.version_api_url}assets/?glob=s*.Txt", text_dandiset.dspath, diff --git a/lincbrain/tests/test_keyring.py b/lincbrain/tests/test_keyring.py index 84bae065d..c2568bfca 100644 --- a/lincbrain/tests/test_keyring.py +++ b/lincbrain/tests/test_keyring.py @@ -32,7 +32,7 @@ def test_dandi_authenticate_no_env_var( monkeypatch.delenv("DANDI_API_KEY", raising=False) monkeypatch.setenv("PYTHON_KEYRING_BACKEND", "keyring.backends.null.Keyring") inputmock = mocker.patch( - "dandi.dandiapi.input", return_value=local_dandi_api.api_key + "lincbrain.dandiapi.input", return_value=local_dandi_api.api_key ) DandiAPIClient(local_dandi_api.api_url).dandi_authenticate() inputmock.assert_called_once_with( @@ -145,7 +145,7 @@ def test_keyring_lookup_default_no_password( ) -> None: monkeypatch.delenv("PYTHON_KEYRING_BACKEND", raising=False) kb0 = null.Keyring() - get_keyring = mocker.patch("dandi.keyring.get_keyring", return_value=kb0) + get_keyring = mocker.patch("lincbrain.keyring.get_keyring", return_value=kb0) kb, password = keyring_lookup("testservice", "testusername") assert kb is kb0 assert password is None @@ -159,7 +159,7 @@ def test_keyring_lookup_default_password( monkeypatch.delenv("PYTHON_KEYRING_BACKEND", raising=False) kb0 = keyfile.PlaintextKeyring() kb0.set_password("testservice", "testusername", "testpassword") - get_keyring = mocker.patch("dandi.keyring.get_keyring", return_value=kb0) + get_keyring = mocker.patch("lincbrain.keyring.get_keyring", return_value=kb0) kb, password = keyring_lookup("testservice", "testusername") assert kb is kb0 assert password == "testpassword" @@ -176,7 +176,7 @@ def test_keyring_lookup_fail_default_encrypted( ) -> None: monkeypatch.delenv("PYTHON_KEYRING_BACKEND", raising=False) get_keyring = mocker.patch( - "dandi.keyring.get_keyring", return_value=EncryptedFailure() + "lincbrain.keyring.get_keyring", return_value=EncryptedFailure() ) with pytest.raises(KeyringError): keyring_lookup("testservice", "testusername") From 1d5db727c2b134fd1c1fd9d09b4672027a3084c8 Mon Sep 17 00:00:00 2001 From: Aaron Kanzer Date: Mon, 12 Feb 2024 15:55:26 -0500 Subject: [PATCH 2/2] Update DANDI_API_KEY to LINCBRAIN_API_KEY --- DEVELOPMENT.md | 2 +- lincbrain/cli/tests/test_service_scripts.py | 4 +- lincbrain/dandiapi.py | 6 +- lincbrain/tests/fixtures.py | 2 +- lincbrain/tests/test_dandiapi.py | 6 +- lincbrain/tests/test_delete.py | 30 ++++----- lincbrain/tests/test_keyring.py | 2 +- lincbrain/tests/test_move.py | 68 ++++++++++----------- tools/update-assets-on-server | 2 +- 9 files changed, 61 insertions(+), 61 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 293586ae3..dfda31b2e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -55,7 +55,7 @@ development command line options. otherwise be hidden from the user-visible (`--help`) interface, unless this env variable is set to a non-empty value -- `DANDI_API_KEY` -- avoids using keyrings, thus making it possible to +- `LINCBRAIN_API_KEY` -- avoids using keyrings, thus making it possible to "temporarily" use another account etc for the "API" version of the server. - `DANDI_LOG_LEVEL` -- set log level. By default `INFO`, should be an int (`10` - `DEBUG`). diff --git a/lincbrain/cli/tests/test_service_scripts.py b/lincbrain/cli/tests/test_service_scripts.py index d779baea4..a76d84a93 100644 --- a/lincbrain/cli/tests/test_service_scripts.py +++ b/lincbrain/cli/tests/test_service_scripts.py @@ -28,7 +28,7 @@ def test_reextract_metadata( asset_id = nwb_dandiset.dandiset.get_asset_by_path( "sub-mouse001/sub-mouse001.nwb" ).identifier - monkeypatch.setenv("DANDI_API_KEY", nwb_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", nwb_dandiset.api.api_key) r = CliRunner().invoke( service_scripts, ["reextract-metadata", "--when=always", nwb_dandiset.dandiset.version_api_url], @@ -71,7 +71,7 @@ def test_update_dandiset_from_doi( ) -> None: dandiset_id = new_dandiset.dandiset_id repository = new_dandiset.api.instance.gui - monkeypatch.setenv("DANDI_API_KEY", new_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", new_dandiset.api.api_key) if os.environ.get("DANDI_TESTS_NO_VCR", ""): ctx = nullcontext() else: diff --git a/lincbrain/dandiapi.py b/lincbrain/dandiapi.py index 314306f69..4f60d57c7 100644 --- a/lincbrain/dandiapi.py +++ b/lincbrain/dandiapi.py @@ -477,7 +477,7 @@ def authenticate(self, token: str, save_to_keyring: bool = False) -> None: def dandi_authenticate(self) -> None: """ Acquire and set the authentication token/API key used by the - `DandiAPIClient`. If the :envvar:`DANDI_API_KEY` environment variable + `DandiAPIClient`. If the :envvar:`LINCBRAIN_API_KEY` environment variable is set, its value is used as the token. Otherwise, the token is looked up in the user's keyring under the service ":samp:`dandi-api-{INSTANCE_NAME}`" [#auth]_ and username "``key``". @@ -488,9 +488,9 @@ def dandi_authenticate(self) -> None: "``dandi-api-dandi-staging``" for the staging server """ # Shortcut for advanced folks - api_key = os.environ.get("DANDI_API_KEY", None) + api_key = os.environ.get("LINCBRAIN_API_KEY", None) if api_key: - lgr.debug("Using api key from DANDI_API_KEY environment variable") + lgr.debug("Using api key from LINCBRAIN_API_KEY environment variable") self.authenticate(api_key) return client_name, app_id = self._get_keyring_ids() diff --git a/lincbrain/tests/fixtures.py b/lincbrain/tests/fixtures.py index dce8e1fed..308b98c93 100644 --- a/lincbrain/tests/fixtures.py +++ b/lincbrain/tests/fixtures.py @@ -505,7 +505,7 @@ def client(self) -> DandiAPIClient: def upload(self, paths: list[str | Path] | None = None, **kwargs: Any) -> None: with pytest.MonkeyPatch().context() as m: - m.setenv("DANDI_API_KEY", self.api.api_key) + m.setenv("LINCBRAIN_API_KEY", self.api.api_key) upload( paths=paths or [self.dspath], dandi_instance=self.api.instance_id, diff --git a/lincbrain/tests/test_dandiapi.py b/lincbrain/tests/test_dandiapi.py index 6c3f5f8f8..226928f9f 100644 --- a/lincbrain/tests/test_dandiapi.py +++ b/lincbrain/tests/test_dandiapi.py @@ -131,7 +131,7 @@ def test_authenticate_bad_key_good_key_input( ) confirm_mock = mocker.patch("click.confirm", return_value=True) - monkeypatch.delenv("DANDI_API_KEY", raising=False) + monkeypatch.delenv("LINCBRAIN_API_KEY", raising=False) client = DandiAPIClient(local_dandi_api.api_url) assert "Authorization" not in client.session.headers @@ -162,7 +162,7 @@ def test_authenticate_good_key_keyring( is_interactive_spy = mocker.spy(dandiapi, "is_interactive") confirm_spy = mocker.spy(click, "confirm") - monkeypatch.delenv("DANDI_API_KEY", raising=False) + monkeypatch.delenv("LINCBRAIN_API_KEY", raising=False) client = DandiAPIClient(local_dandi_api.api_url) assert "Authorization" not in client.session.headers @@ -194,7 +194,7 @@ def test_authenticate_bad_key_keyring_good_key_input( ) confirm_mock = mocker.patch("click.confirm", return_value=True) - monkeypatch.delenv("DANDI_API_KEY", raising=False) + monkeypatch.delenv("LINCBRAIN_API_KEY", raising=False) client = DandiAPIClient(local_dandi_api.api_url) assert "Authorization" not in client.session.headers diff --git a/lincbrain/tests/test_delete.py b/lincbrain/tests/test_delete.py index 310b1205e..8e64f7f13 100644 --- a/lincbrain/tests/test_delete.py +++ b/lincbrain/tests/test_delete.py @@ -67,7 +67,7 @@ def test_delete_paths( remainder: list[Path], ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -92,7 +92,7 @@ def test_delete_path_confirm( text_dandiset: SampleDandiset, ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -113,7 +113,7 @@ def test_delete_path_pyout( text_dandiset: SampleDandiset, ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") delete(["subdir2/coconut.txt"], dandi_instance=instance, force=True) @@ -143,7 +143,7 @@ def test_delete_dandiset( paths: list[str], ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -166,7 +166,7 @@ def test_delete_dandiset_confirm( text_dandiset: SampleDandiset, ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -187,7 +187,7 @@ def test_delete_dandiset_mismatch( text_dandiset: SampleDandiset, ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id not_dandiset = str(int(dandiset_id) - 1).zfill(6) @@ -216,7 +216,7 @@ def test_delete_instance_mismatch( text_dandiset: SampleDandiset, ) -> None: monkeypatch.chdir(text_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -242,7 +242,7 @@ def test_delete_instance_mismatch( def test_delete_nonexistent_dandiset( local_dandi_api: DandiAPI, mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch ) -> None: - monkeypatch.setenv("DANDI_API_KEY", local_dandi_api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", local_dandi_api.api_key) instance = local_dandi_api.instance_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") with pytest.raises(NotFoundError) as excinfo: @@ -259,7 +259,7 @@ def test_delete_nonexistent_dandiset( def test_delete_nonexistent_dandiset_skip_missing( local_dandi_api: DandiAPI, mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch ) -> None: - monkeypatch.setenv("DANDI_API_KEY", local_dandi_api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", local_dandi_api.api_key) instance = local_dandi_api.instance_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") delete( @@ -277,7 +277,7 @@ def test_delete_nonexistent_asset( monkeypatch: pytest.MonkeyPatch, text_dandiset: SampleDandiset, ) -> None: - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -304,7 +304,7 @@ def test_delete_nonexistent_asset_skip_missing( text_dandiset: SampleDandiset, tmp_path: Path, ) -> None: - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -333,7 +333,7 @@ def test_delete_nonexistent_asset_folder( monkeypatch: pytest.MonkeyPatch, text_dandiset: SampleDandiset, ) -> None: - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -360,7 +360,7 @@ def test_delete_nonexistent_asset_folder_skip_missing( text_dandiset: SampleDandiset, tmp_path: Path, ) -> None: - monkeypatch.setenv("DANDI_API_KEY", text_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", text_dandiset.api.api_key) instance = text_dandiset.api.instance_id dandiset_id = text_dandiset.dandiset_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") @@ -387,7 +387,7 @@ def test_delete_nonexistent_asset_folder_skip_missing( def test_delete_version( local_dandi_api: DandiAPI, mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch ) -> None: - monkeypatch.setenv("DANDI_API_KEY", local_dandi_api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", local_dandi_api.api_key) instance = local_dandi_api.instance_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") with pytest.raises(NotImplementedError) as excinfo: @@ -430,7 +430,7 @@ def test_delete_zarr_path( tmp_path: Path, ) -> None: monkeypatch.chdir(zarr_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", zarr_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", zarr_dandiset.api.api_key) instance = zarr_dandiset.api.instance_id delete_spy = mocker.spy(RESTFullAPIClient, "delete") delete(["sample.zarr"], dandi_instance=instance, devel_debug=True, force=True) diff --git a/lincbrain/tests/test_keyring.py b/lincbrain/tests/test_keyring.py index c2568bfca..3d54cae48 100644 --- a/lincbrain/tests/test_keyring.py +++ b/lincbrain/tests/test_keyring.py @@ -29,7 +29,7 @@ def ensure_keyring_backends() -> None: def test_dandi_authenticate_no_env_var( local_dandi_api: DandiAPI, monkeypatch: pytest.MonkeyPatch, mocker: MockerFixture ) -> None: - monkeypatch.delenv("DANDI_API_KEY", raising=False) + monkeypatch.delenv("LINCBRAIN_API_KEY", raising=False) monkeypatch.setenv("PYTHON_KEYRING_BACKEND", "keyring.backends.null.Keyring") inputmock = mocker.patch( "lincbrain.dandiapi.input", return_value=local_dandi_api.api_key diff --git a/lincbrain/tests/test_move.py b/lincbrain/tests/test_move.py index 3f1eb5e0d..e568328e7 100644 --- a/lincbrain/tests/test_move.py +++ b/lincbrain/tests/test_move.py @@ -172,7 +172,7 @@ def test_move( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( *srcs, dest=dest, @@ -194,7 +194,7 @@ def test_move_skip( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir4/foo.json", @@ -221,7 +221,7 @@ def test_move_error( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( "file.txt", @@ -248,7 +248,7 @@ def test_move_overwrite( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir4/foo.json", @@ -275,7 +275,7 @@ def test_move_no_srcs( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( dest="nowhere", @@ -291,7 +291,7 @@ def test_move_regex_multisrcs( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( r"\.txt", @@ -317,7 +317,7 @@ def test_move_multisrcs_file_dest( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( "file.txt", @@ -343,7 +343,7 @@ def test_move_folder_src_file_dest( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( "subdir1", @@ -365,7 +365,7 @@ def test_move_nonexistent_src( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(NotFoundError) as excinfo: move( "file.txt", @@ -391,7 +391,7 @@ def test_move_file_slash_src( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( "file.txt", @@ -417,7 +417,7 @@ def test_move_file_slash_dest( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( "file.txt", @@ -437,7 +437,7 @@ def test_move_regex_no_match( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( "no-match", @@ -458,7 +458,7 @@ def test_move_regex_collision( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( r"^\w+/foo\.json$", @@ -486,7 +486,7 @@ def test_move_regex_some_to_self( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( r"(.+[123])/([^.]+)\.(.+)", dest=r"\1/\2.dat", @@ -528,7 +528,7 @@ def test_move_from_subdir( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "../file.txt", "apple.txt", @@ -558,7 +558,7 @@ def test_move_in_subdir( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "apple.txt", dest="macintosh.txt", @@ -584,7 +584,7 @@ def test_move_from_subdir_abspaths( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(NotFoundError) as excinfo: move( "file.txt", @@ -610,7 +610,7 @@ def test_move_from_subdir_as_dot( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(ValueError) as excinfo: move( ".", @@ -633,7 +633,7 @@ def test_move_from_subdir_regex( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( r"\.txt", dest=".dat", @@ -661,7 +661,7 @@ def test_move_from_subdir_regex_no_changes( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( r"\.txt", dest=".txt", @@ -685,7 +685,7 @@ def test_move_dandiset_path( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(tmp_path) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir2/banana.txt", @@ -715,7 +715,7 @@ def test_move_dandiset_url( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(tmp_path) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir2/banana.txt", @@ -740,7 +740,7 @@ def test_move_work_on_auto( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir2/banana.txt", @@ -777,7 +777,7 @@ def test_move_local_delete_empty_dirs( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir4") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "../subdir1/apple.txt", "../subdir2/banana.txt", @@ -807,7 +807,7 @@ def test_move_both_src_path_not_in_local( (moving_dandiset.dspath / "subdir2" / "banana.txt").unlink() starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(AssetMismatchError) as excinfo: move( "subdir2", @@ -832,7 +832,7 @@ def test_move_both_src_path_not_in_remote( (moving_dandiset.dspath / "subdir2" / "mango.txt").write_text("Mango\n") starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(AssetMismatchError) as excinfo: move( "subdir2", @@ -857,7 +857,7 @@ def test_move_both_dest_path_not_in_remote( (moving_dandiset.dspath / "subdir2" / "file.txt").write_text("This is a file.\n") starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(AssetMismatchError) as excinfo: move( "file.txt", @@ -884,7 +884,7 @@ def test_move_both_dest_path_not_in_local( (moving_dandiset.dspath / "subdir2" / "banana.txt").unlink() starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(AssetMismatchError) as excinfo: move( "file.txt", @@ -913,7 +913,7 @@ def test_move_both_dest_mismatch( (moving_dandiset.dspath / "subdir1" / "apple.txt" / "seeds").write_text("12345\n") starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) with pytest.raises(AssetMismatchError) as excinfo: move( "file.txt", @@ -943,7 +943,7 @@ def test_move_pyout( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir4/foo.json", @@ -975,7 +975,7 @@ def test_move_pyout_dry_run( ) -> None: starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", "subdir4/foo.json", @@ -1001,7 +1001,7 @@ def test_move_path_to_self( (moving_dandiset.dspath / "newdir").mkdir() starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath / "subdir1") - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "apple.txt", dest="../subdir1", @@ -1029,7 +1029,7 @@ def test_move_remote_dest_is_local_dir_sans_slash( (moving_dandiset.dspath / "newdir").mkdir() starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", dest="newdir", @@ -1048,7 +1048,7 @@ def test_move_both_dest_is_local_dir_sans_slash( (moving_dandiset.dspath / "newdir").mkdir() starting_assets = list(moving_dandiset.dandiset.get_assets()) monkeypatch.chdir(moving_dandiset.dspath) - monkeypatch.setenv("DANDI_API_KEY", moving_dandiset.api.api_key) + monkeypatch.setenv("LINCBRAIN_API_KEY", moving_dandiset.api.api_key) move( "file.txt", dest="newdir", diff --git a/tools/update-assets-on-server b/tools/update-assets-on-server index 1bbeb190a..1fd4a28f6 100755 --- a/tools/update-assets-on-server +++ b/tools/update-assets-on-server @@ -59,7 +59,7 @@ def get_meta(path, digest=None): "-a", "--api_key", type=str, - default=os.environ.get("DANDI_API_KEY", ""), + default=os.environ.get("LINCBRAIN_API_KEY", ""), help="API key to use", ) def process_dandiset(dandiset, update, api_key):