ibllib.tests.test_oneibl

Functions

get_mock_session_settings

Create a basic session settings file for testing.

Classes

TestAlyx2Path

TestDataHandlers

Tests for ibllib.oneibl.data_handlers.DataHandler classes.

TestExpectedDataset

TestFTPPatcher

TestGlobusPatcher

Tests for the ibllib.oneibl.patcher.GlobusPatcher class.

TestRegistration

TestSDSCDataHandler

Test for SDSCDataHandler class.

TestUtils

Test helper functions in ibllib.oneibl.registration module.

class TestUtils(methodName='runTest')[source]

Bases: TestCase

Test helper functions in ibllib.oneibl.registration module.

test_get_lab()[source]

Test ibllib.oneibl.registration.get_lab function.

class TestFTPPatcher(methodName='runTest')[source]

Bases: TestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

reset_params()[source]

Remove the FTP parameters from the AlyxClient

test_setup(_)[source]
static mock_input(prompt)[source]
class TestGlobusPatcher(methodName='runTest')[source]

Bases: TestCase

Tests for the ibllib.oneibl.patcher.GlobusPatcher class.

globus_sdk_mock = None

Mock object for globus_sdk package.

Type:

unittest.mock._patch

setUp(_) None[source]

Hook method for setting up the test fixture before exercising it.

test_patch_datasets()[source]

Tests for GlobusPatcher.patch_datasets and GlobusPatcher.launch_transfers methods.

class TestAlyx2Path(methodName='runTest')[source]

Bases: TestCase

dset = {'collection': 'alf/probe00', 'file_records': [{'data_repository': 'ibl_floferlab_SR', 'data_repository_path': '/mnt/s0/Data/Subjects/', 'data_url': None, 'exists': True, 'id': 'c9ae1b6e-03a6-41c9-9e1b-4a7f9b5cfdbf', 'relative_path': 'SWC_014/2019-12-11/001/alf/probe00/channels.localCoordinates.npy'}, {'data_repository': 'flatiron_hoferlab', 'data_repository_path': '/hoferlab/Subjects/', 'data_url': 'https://ibl.flatironinstitute.org/hoferlab/Subjects/SWC_014/2019-12-11/001/alf/probe00/channels.localCoordinates.00059298-1b33-429c-a802-fa51bb662d72.npy', 'exists': True, 'id': 'f434a638-bc61-4695-884e-70fd1e521d60', 'relative_path': 'SWC_014/2019-12-11/001/alf/probe00/channels.localCoordinates.npy'}], 'name': 'channels.localCoordinates.npy', 'session': 'https://alyx.internationalbrainlab.org/sessions/7cffad38-0f22-4546-92b5-fd6d2e8b2be9', 'url': 'https://alyx.internationalbrainlab.org/datasets/00059298-1b33-429c-a802-fa51bb662d72'}
test_dsets_2_path()[source]
get_mock_session_settings(subject='clns0730', user='test_user')[source]

Create a basic session settings file for testing.

class TestRegistration(methodName='runTest')[source]

Bases: TestCase

subject = ''

The name of the subject under which to create sessions.

Type:

str

one = None

An instance of ONE connected to a test database.

Type:

one.api.OneAlyx

classmethod setUpClass()[source]

Create a random new subject.

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_registration_datasets()[source]
test_create_sessions()[source]
test_registration_session()[source]

Test IBLRegistrationClient.register_session method.

test_registration_session_passive()[source]

Test IBLRegistrationClient.register_session method when there is no iblrig bpod data.

For truly passive sessions there is no Bpod data (no raw_behavior_data or raw_task_data folders). In this situation the must already be a session on Alyx manually created by the experimenter, which needs to contain the start time, location, lab, and user data.

test_register_chained_session()[source]

Tests for registering a session with chained (multiple) protocols.

tearDown() None[source]

Hook method for deconstructing the test fixture after testing it.

classmethod tearDownClass() None[source]

Hook method for deconstructing the class fixture after running all tests in the class.

class TestDataHandlers(methodName='runTest')[source]

Bases: TestCase

Tests for ibllib.oneibl.data_handlers.DataHandler classes.

test_server_upload_data(register_dataset_mock)[source]

A test for ServerDataHandler.uploadData method.

test_getData()[source]

Test for DataHandler.getData method.

test_dataset_from_name()[source]

Test dataset_from_name function.

test_update_collections()[source]

Test update_collections function.

class TestSDSCDataHandler(methodName='runTest')[source]

Bases: TestCase

Test for SDSCDataHandler class.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_handler()[source]

Test for SDSCDataHandler.setUp and cleanUp methods.

class TestExpectedDataset(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_and()[source]
test_or()[source]
test_xor()[source]
test_filter()[source]

Test for ExpectedDataset.filter method.

This test can be extended to support AND operators e.g. (dset1 AND dset2) OR (dset2 AND dset3).

test_identifiers()[source]

Test identifiers property getter.