d1_gmn.tests package

Submodules

d1_gmn.tests.conftest module

d1_gmn.tests.conftest.gmn_client_v1(request)
d1_gmn.tests.conftest.gmn_client_v2(request)
d1_gmn.tests.conftest.gmn_client_v1_v2(request)

d1_gmn.tests.gmn_direct module

d1_gmn.tests.gmn_mock module

d1_gmn.tests.gmn_test_case module

d1_gmn.tests.gmn_test_client module

This module implements GMNTestClient, which extends d1_client.mnclient.MemberNodeClient with GMN specific test functionality.

The REST interfaces on GMN that provide this functionality are prefixed with “/diag/” and are only enabled when GMN runs in debug mode. The interfaces are not versioned, and so there is no version tag (such as “v1”) in the URL for these methods.

class d1_gmn.tests.gmn_test_client.GMNTestClient(*args, **kwargs)

Bases: d1_client.mnclient.MemberNodeClient

__init__(*args, **kwargs)

Extend MemberNodeClient with GMN specific diagnostics wrappers.

See d1baseclient.DataONEBaseClient for args.

gmn_vse_provide_subject(subject)

GMN Vendor Specific Extension: Simulate subject.

gmn_vse_enable_sql_profiling()

GMN Vendor Specific Extension: Enable SQL profiling.

gmn_vse_enable_python_profiling()

GMN Vendor Specific Extension: Enable Python profiling.

get_resource_path(path)

Get path to test resources.

get_replication_queue(headers=None)
clear_replication_queue(headers=None)
create_replication_queue(pid, sysmeta_pyxb, sourceNode, vendorSpecific=None)
delete_all_access_policies(headers=None)
get_access_policy(pid, headers=None)
echo_session(headers=None)
whitelist_subject(subject_str, headers=None)

Add a subject to the whitelist.

create(pid, obj, sysmeta_pyxb, vendorSpecific=None)
slash(arg1, arg2, arg3, headers=None)
exception(exception_type, headers=None)
echo_request_object(headers=None)
echo_raw_post_data(headers=None)
delete_all_objects(headers=None)
get_setting(setting, headers=None)
delete_event_log(headers=None)

Delete event log for all objects.

inject_fictional_event_log(event_log_csv, headers=None)

Inject a fake event log.

concurrency_clear(headers=None)

Clear test key/vals.

concurrency_read_lock(key, sleep_before, sleep_after, headers=None)

PID read locking.

concurrency_write_lock(key, val, sleep_before, sleep_after, headers=None)

Test PID write locking.

concurrency_get_dictionary_id(headers=None)

Get dictionary ID.

d1_gmn.tests.gmn_wsgi module

class d1_gmn.tests.gmn_wsgi.WSGIClient(django_settings_module=None, enforce_csrf_checks=True, *args, **kwargs)

Bases: django.core.handlers.base.BaseHandler

Submit requests to GMN directly via its WSGI interface.

This client submits a raw WSGIRequest and returns the raw HttpResponse, both of which can contain streams.

The test client that is bundled with Django collapses all streams to bytes, both in requests and responses, so cannot be used for testing stream handling.

__init__(django_settings_module=None, enforce_csrf_checks=True, *args, **kwargs)

Initialize the client and corresponding Django service.

Parameters
  • django_settings_module – str Override the DJANGO_SETTINGS_MODULE environment variable setting.

    Requests will be sent to the Django service selected by the DJANGO_SETTINGS_MODULE environment variable. When running under pytest-django, the default value is set in ``tox.ini`.

  • enforce_csrf_checks – bool Disable Cross Site Request Forgery protection.

send_request(wsgi_environ_dict)

Send a WSGIRequest to a Django based service.

Parameters

wsgi_environ_dict – dict WSGI environ dict from which to build a WSGIRequest.

Example for MNStorage.create():

{

“REQUEST_METHOD”: “POST”, “PATH_INFO”: “/v2/object”, “CONTENT_TYPE”: <content type of provided stream>, “CONTENT_LENGTH”: <length of provided stream>, “REMOTE_ADDR”: <IP or FQDN of client>, “wsgi.input”: <

MIME multipart stream providing the body of the request

>,

}

Returns

HttpResponse

d1_gmn.tests.mk_db_fixture module

d1_gmn.tests.mk_db_template module

d1_gmn.tests.test_api_is_authorized module

d1_gmn.tests.test_app_util module

d1_gmn.tests.test_archive_standalone module

d1_gmn.tests.test_authorization module

d1_gmn.tests.test_cert module

d1_gmn.tests.test_content_disposition module

d1_gmn.tests.test_cors module

d1_gmn.tests.test_create_and_get_standalone module

d1_gmn.tests.test_create_resource_map module

d1_gmn.tests.test_delete_standalone module

d1_gmn.tests.test_describe module

d1_gmn.tests.test_generate_identifier module

d1_gmn.tests.test_get_capabilities module

d1_gmn.tests.test_get_checksum module

d1_gmn.tests.test_get_log_records module

d1_gmn.tests.test_get_log_records_auth module

d1_gmn.tests.test_get_package module

d1_gmn.tests.test_get_system_metadata module

d1_gmn.tests.test_list_objects module

d1_gmn.tests.test_mgmt_cert module

d1_gmn.tests.test_mgmt_diag_export_object_list module

d1_gmn.tests.test_mgmt_diag_repair_revision_chains module

d1_gmn.tests.test_mgmt_diag_update_sysmeta module

d1_gmn.tests.test_mgmt_import module

d1_gmn.tests.test_proxy_mode module

d1_gmn.tests.test_remote_replica module

d1_gmn.tests.test_replicate module

d1_gmn.tests.test_revision module

d1_gmn.tests.test_revision_archive module

d1_gmn.tests.test_revision_create_and_get module

d1_gmn.tests.test_revision_delete module

d1_gmn.tests.test_scimeta module

d1_gmn.tests.test_session_jwt module

d1_gmn.tests.test_settings module

d1_gmn.tests.test_slice module

d1_gmn.tests.test_streaming module

d1_gmn.tests.test_synchronization_failed module

d1_gmn.tests.test_sysmeta_extract module

d1_gmn.tests.test_system_metadata_changed module

d1_gmn.tests.test_timezone module

d1_gmn.tests.test_trusted_client_overrides module

d1_gmn.tests.test_update_system_metadata module

d1_gmn.tests.test_update_with_sid module

d1_gmn.tests.test_update_without_sid module

d1_gmn.tests.test_web_ui module