one.tests.test_one¶
Tests for the one.api module
Wherever possible the ONE tests should not rely on an internet connection
The cache tables for the public test instance are in tests/fixtures/ The test db parameters can be found in tests/fixtures/params/ Some REST GET requests can be found in tests/fixtures/rest_responses/ These can be copied over to a temporary directory using the functions in tests/util.py, then construct ONE with the directory as cache_dir, mode=’local’ and silent=True
For tests that do require a remote connection use the tests.OFFLINE_ONLY flag in the skipIf decorator For testing REST POST requests use TEST_DB_1 (test.alyx.internationalbrainlab.org) For testing download functions, use TEST_DB_2 (openalyx.internationalbrainlab.org)
- Note ONE and AlyxClient use caching:
When verifying remote changes via the rest method, use the no_cache flag to ensure the remote
databaseis queried. You can clear the cache using AlyxClient.clear_rest_cache(), or mock iblutil.io.params.getfile to return a temporary cache directory - An One object created through the one.api.ONE function, make sure you restore the properties to their original state on teardown, or call one.api.ONE.cache_clear()
Classes
Test methods that use sessions and datasets tables This class loads the parquet tables from the fixtures and builds a file tree in a temp folder |
|
This could be an offline test. |
|
Test downloading datasets using OpenAlyx |
|
Test remote queries |
|
-
class
TestONECache
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test methods that use sessions and datasets tables This class loads the parquet tables from the fixtures and builds a file tree in a temp folder
-
tempdir
= None¶
-
classmethod
setUpClass
() → None[source]¶ Hook method for setting up class fixture before running tests in the class.
-
-
class
TestOneAlyx
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
This could be an offline test. Would need to add /docs REST cache fixture.
-
tempdir
= None¶
-
one
= None¶
-
-
class
TestOneRemote
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test remote queries
-
class
TestOneDownload
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Test downloading datasets using OpenAlyx
-
tempdir
= None¶
-
one
= None¶
-