one.tests.test_alyxclient

Unit tests for the one.webclient module

Classes

TestAuthentication

Tests for AlyxClient authentication, token storage, login/out methods and user prompts

TestDownloadHTTP

TestJsonFieldMethods

Tests for AlyxClient methods that modify the JSON field of a REST endpoint.

TestMisc

TestRestCache

Tests for REST caching system, the cache decorator and cache flags

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

Bases: TestCase

Tests for AlyxClient authentication, token storage, login/out methods and user prompts

setUp() None[source]

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

test_authentication()[source]

Test for AlyxClient.authenticate and AlyxClient.is_logged_in property

test_auth_methods()[source]

Test behaviour when calling AlyxClient._generic_request when logged out

test_auth_errors()[source]

Test behaviour when authentication fails

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

Bases: TestCase

Tests for AlyxClient methods that modify the JSON field of a REST endpoint.

These tests are over-engineered in order to test Alyx Django queries with JSON fields. Django queries are also tested in TestRemote.test_search.

setUp()[source]

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

test_json_methods()[source]

Test for AlyxClient.json_field* methods (write, update, remove_key and delete)

test_empty()[source]

Test for AlyxClient.json_field* methods when JSON field is empty

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

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

Bases: TestCase

Tests for REST caching system, the cache decorator and cache flags

setUp()[source]

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

test_loads_cached()[source]

Test for one.webclient._cache_response decorator, checks returns cached result

test_expired_cache()[source]

Test behaviour when cached REST query is expired

test_caches_response()[source]

Test caches query response before returning

test_cache_mode()[source]

Test for AlyxClient.cache_mode property

test_expiry_param()[source]

Test for expires kwarg in one.webclient._cache_response decorator

test_cache_returned_on_error()[source]

Test behaviour when connection error occurs and cached response exists

test_clear_cache()[source]

Test for AlyxClient.clear_rest_cache

tearDown() None[source]

Hook method for deconstructing the test fixture after testing it.

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

Bases: TestCase

setUp()[source]

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

test_download_datasets_with_api()[source]
test_download_datasets()[source]
class TestMisc(methodName='runTest')[source]

Bases: TestCase

test_update_url_params()[source]

Test for one.webclient.update_url_params

test_validate_file_url()[source]

Test for AlyxClient._validate_file_url

test_no_cache_context_manager()[source]

Test for one.webclient.no_cache function

test_cache_dir_setter()[source]

Tests setter for AlyxClient.cache_dir attribute.