|
4 | 4 | import uuid |
5 | 5 | import tempfile |
6 | 6 | from pathlib import Path |
7 | | -import sys |
8 | 7 | import logging |
9 | 8 | import json |
10 | | -from datetime import datetime |
11 | 9 |
|
12 | 10 | import numpy as np |
13 | 11 | from one.api import ONE |
14 | 12 | from iblutil.io import params |
15 | 13 | import yaml |
16 | 14 |
|
17 | 15 | from ibllib.tests import TEST_DB |
18 | | -from ibllib.io import flags, misc, globus, video, session_params |
| 16 | +from ibllib.io import flags, misc, video, session_params |
19 | 17 | import ibllib.io.raw_data_loaders as raw |
20 | 18 | import ibllib.io.raw_daq_loaders as raw_daq |
21 | 19 |
|
@@ -369,55 +367,6 @@ def test_delete_empty_folders(self): |
369 | 367 | self.assertTrue(all([x == y for x, y in zip(pos, pos_expected)])) |
370 | 368 |
|
371 | 369 |
|
372 | | -class TestsGlobus(unittest.TestCase): |
373 | | - def setUp(self): |
374 | | - self.patcher = patch.multiple('globus_sdk', |
375 | | - NativeAppAuthClient=unittest.mock.DEFAULT, |
376 | | - RefreshTokenAuthorizer=unittest.mock.DEFAULT, |
377 | | - TransferClient=unittest.mock.DEFAULT) |
378 | | - self.patcher.start() |
379 | | - self.addCleanup(self.patcher.stop) |
380 | | - |
381 | | - def test_as_globus_path(self): |
382 | | - assert datetime.now() < datetime(2024, 1, 30), 'remove deprecated module' |
383 | | - # A Windows path |
384 | | - if sys.platform == 'win32': |
385 | | - # "/E/FlatIron/integration" |
386 | | - actual = globus.as_globus_path('E:\\FlatIron\\integration') |
387 | | - self.assertTrue(actual.startswith('/E/')) |
388 | | - # A relative POSIX path |
389 | | - actual = globus.as_globus_path('/mnt/foo/../data/integration') |
390 | | - expected = '/mnt/data/integration' # "/C/mnt/data/integration |
391 | | - self.assertTrue(actual.endswith(expected)) |
392 | | - |
393 | | - # A globus path |
394 | | - actual = globus.as_globus_path('/E/FlatIron/integration') |
395 | | - expected = '/E/FlatIron/integration' |
396 | | - self.assertEqual(expected, actual) |
397 | | - |
398 | | - @unittest.mock.patch('iblutil.io.params.read') |
399 | | - def test_login_auto(self, mock_params): |
400 | | - assert datetime.now() < datetime(2024, 1, 30), 'remove deprecated module' |
401 | | - client_id = 'h3u2ier' |
402 | | - # Test ValueError thrown with incorrect parameters |
403 | | - mock_params.return_value = None # No parameters saved |
404 | | - with self.assertRaises(ValueError): |
405 | | - globus.login_auto(client_id) |
406 | | - # mock_params.assert_called_with('globus/default') |
407 | | - |
408 | | - pars = params.from_dict({'access_token': '7r3hj89', 'expires_at_seconds': '2020-09-10'}) |
409 | | - mock_params.return_value = pars # Incomplete parameter object |
410 | | - with self.assertRaises(ValueError): |
411 | | - globus.login_auto(client_id) |
412 | | - |
413 | | - # Complete parameter object |
414 | | - mock_params.return_value = pars.set('refresh_token', '37yh4') |
415 | | - gtc = globus.login_auto(client_id) |
416 | | - self.assertIsInstance(gtc, unittest.mock.Mock) |
417 | | - mock, _ = self.patcher.get_original() |
418 | | - mock.assert_called_once_with(client_id) |
419 | | - |
420 | | - |
421 | 370 | class TestVideo(unittest.TestCase): |
422 | 371 | @classmethod |
423 | 372 | def setUpClass(cls) -> None: |
|
0 commit comments