tardis.tardis_portal.tests package

Subpackages

Submodules

tardis.tardis_portal.tests.ldap_ldif module

tardis.tardis_portal.tests.slapd module

Utilities for starting up a test slapd server and talking to it with ldapsearch/ldapadd.

class tardis.tardis_portal.tests.slapd.Slapd

Bases: object

Controller class for a slapd instance, OpenLDAP’s server.

This class creates a temporary data store for slapd, runs it on a private port, and initialises it with a top-level dc and the root user.

When a reference to an instance of this class is lost, the slapd server is shut down.

PATH_LDAPADD = None
PATH_LDAPSEARCH = None
PATH_SCHEMA_DIR = '/home/docs/checkouts/readthedocs.org/user_builds/mytardis/checkouts/v4.5.0-rc4/tardis/tardis_portal/tests/ldap_schemas/'
PATH_SLAPD = None
PATH_SLAPTEST = None
PATH_TMPDIR = '/tmp/tmpala0i1dz'
TEST_UTILS_DIR = '/home/docs/checkouts/readthedocs.org/user_builds/mytardis/checkouts/v4.5.0-rc4/tardis/tardis_portal/tests'
classmethod check_paths()

Checks that the configured executable paths look valid. If they don’t, then logs warning messages (not errors).

configure(cfg)

Appends slapd.conf configuration lines to cfg. Also re-initializes any backing storage. Feel free to subclass and override this method.

get_address()
get_dn_suffix()
get_root_dn()
get_root_password()
get_tmpdir()
get_url()
ldapadd(ldif, extra_args=[])

Runs ldapadd on this slapd instance, passing it the ldif content

ldapsearch(base=None, filter='(objectClass=*)', attrs=[], scope='sub', extra_args=[])
restart()

Restarts the slapd server; ERASING previous content. Starts the server even it if isn’t already running.

set_debug()
set_dn_suffix(dn)
set_port(port)
set_root_cn(cn)
set_root_password(pw)
set_slapd_debug_level(level)
set_tmpdir(path)
start()

Starts the slapd server process running, and waits for it to come up.

started()

This method is called when the LDAP server has started up and is empty. By default, this method adds the two initial objects, the domain object and the root user object.

stop()

Stops the slapd server, and waits for it to terminate

wait()

Waits for the slapd process to terminate by itself.

tardis.tardis_portal.tests.slapd.delete_directory_content(path)
tardis.tardis_portal.tests.slapd.find_available_tcp_port(host='127.0.0.1')
tardis.tardis_portal.tests.slapd.mkdirs(path)

Creates the directory path unless it already exists

tardis.tardis_portal.tests.slapd.quote(s)

Quotes the ” and characters in a string and surrounds with “…”

tardis.tardis_portal.tests.slapd.which(executable)

tardis.tardis_portal.tests.test_authentication module

Created on 19/01/2011

class tardis.tardis_portal.tests.test_authentication.AuthenticationTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

testManageAuthMethods(mock_webpack_get_bundle)
testSimpleAuthenticate()
test_djangoauth()

tardis.tardis_portal.tests.test_authorisation module

class tardis.tardis_portal.tests.test_authorisation.ObjectACLTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

testCantEditLockedExperiment(mock_webpack_get_bundle)
testChangeUserPermissions(mock_webpack_get_bundle)
testOwnedExperiments()
testReadAccess(mock_webpack_get_bundle)
testWriteAccess(mock_webpack_get_bundle)
urls = 'tardis.urls'

tardis.tardis_portal.tests.test_authservice module

class tardis.tardis_portal.tests.test_authservice.AuthServiceTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

testAuthenticate()
testGetGroupsForEntity()
testGroupProvider()
testGroupSearch()
testInitialisation()
class tardis.tardis_portal.tests.test_authservice.MockAuthProvider

Bases: object

authenticate(request)
class tardis.tardis_portal.tests.test_authservice.MockGroupProvider

Bases: tardis.tardis_portal.auth.interfaces.GroupProvider

getGroupById(id)

return the group associated with the id

getGroups(user)

return an iteration of the available groups.

getGroupsForEntity(id)

return a list of groups associated with a particular entity id

searchGroups(**filter)

return a list of groups that match the filter

class tardis.tardis_portal.tests.test_authservice.MockRequest

Bases: django.http.request.HttpRequest

setPost(field, value)
class tardis.tardis_portal.tests.test_authservice.MockSettings

Bases: object

tardis.tardis_portal.tests.test_copy_move module

test_copy_move.py

Test copying and moving a file to another storage box

class tardis.tardis_portal.tests.test_copy_move.CopyMoveTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

Test copying and moving files between storage boxes

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_cache()

Test caching a file from a slow-access storage box

test_copy()

Test copying a file to another storage box

test_move()

Test moving a file to another storage box

tardis.tardis_portal.tests.test_df_save_metadata module

class tardis.tardis_portal.tests.test_df_save_metadata.DatafileSaveMetadataTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_df_save_metadata()

Test the DataFile metadata saving task used by the post-save filters microservice

tardis.tardis_portal.tests.test_download module

class tardis.tardis_portal.tests.test_download.DownloadTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

testDatasetFile()
testDownload(mock_webpack_get_bundle)
testView(mock_webpack_get_bundle)
tardis.tardis_portal.tests.test_download.get_size_and_sha512sum(testfile)

tardis.tardis_portal.tests.test_download_apikey module

class tardis.tardis_portal.tests.test_download_apikey.ApiKeyDownloadTestCase(methodName='runTest')

Bases: tastypie.test.ResourceTestCaseMixin, django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_download_apikey()

tardis.tardis_portal.tests.test_facility_overview module

Tests relating to facility overview

class tardis.tardis_portal.tests.test_facility_overview.FacilityOverviewTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

test_facility_overview_datafile_list()
test_facility_overview_experiments()

Despite the name of the test_facility_overview_experiments method, it actually returns a JSON list of datasets (not experiments)

tardis.tardis_portal.tests.test_forms module

test_models.py http://docs.djangoproject.com/en/dev/topics/testing/

class tardis.tardis_portal.tests.test_forms.RightsFormTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

test_ensures_suitable_license()

tardis.tardis_portal.tests.test_iiif module

class tardis.tardis_portal.tests.test_iiif.ExtraTestCases(methodName='runTest')

Bases: django.test.testcases.TestCase

As per: http://library.stanford.edu/iiif/image-api/compliance.html

setUp()

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

testImageCacheControl()
testImageHasEtags()
testInfoHasEtags()
class tardis.tardis_portal.tests.test_iiif.Level0TestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

As per: http://library.stanford.edu/iiif/image-api/compliance.html

setUp()

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

testCanGetInfoAsJSON()
testCanGetInfoAsXML()
testCanGetOriginalImage()
class tardis.tardis_portal.tests.test_iiif.Level1TestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

As per: http://library.stanford.edu/iiif/image-api/compliance.html

setUp()

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

testCanGetJpegFormat()
testHandleRegions()
testHandleRotation()
testHandleSizing()
class tardis.tardis_portal.tests.test_iiif.Level2TestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

As per: http://library.stanford.edu/iiif/image-api/compliance.html

setUp()

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

testCanGetRequiredFormats()
testHandleSizing()

tardis.tardis_portal.tests.test_ldap module

class tardis.tardis_portal.tests.test_ldap.LDAPErrorTest(methodName='runTest')

Bases: django.test.testcases.TestCase

class tardis.tardis_portal.tests.test_ldap.LDAPTest(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_authenticate()
test_getgroupbyid()
test_getgroups()
test_getgroupsforentity()
test_getuserbyid()
test_searchgroups()

tardis.tardis_portal.tests.test_models module

tardis.tardis_portal.tests.test_parameters module

test_parameters.py

class tardis.tardis_portal.tests.test_parameters.ParametersTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

Tests for the different parameter types, defined in the tardis.tardis_portal.models.parameters.ParameterName class:

NUMERIC, STRING, URL, LINK, FILENAME, DATETIME, LONGSTRING and JSON

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_experiment_parameter_get()

Test the Parameter class’s get() method which should return an appropriate string representation of the parameter which depends on the parameter’s data type:

NUMERIC, STRING, URL, LINK, FILENAME, DATETIME, LONGSTRING or JSON

test_image_filename_parameters()

When a FILENAME parameter refers to a thumbanil image file, MyTardis can generate a HTML for displaying that image.

This method tests the generation of the image HTML

Test URLs generated for parameters which link to MyTardis model records

test_permissions_checks()

Test permissions checks, used by tardis.tardis_portal.auth.authorisation

tardis.tardis_portal.tests.test_parametersets module

test_parametersets.py http://docs.djangoproject.com/en/dev/topics/testing/

class tardis.tardis_portal.tests.test_parametersets.EditParameterSetTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_add_datafile_params()
test_add_dataset_params()
test_add_experiment_params()
test_edit_datafile_params()
test_edit_dataset_params()
test_edit_experiment_params()
class tardis.tardis_portal.tests.test_parametersets.ParameterSetManagerTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_existing_parameterset()

Test that Parameter.link_gfk (GenericForeignKey) is correctly assigned after using Parameter.set_value(some_url) for a LINK Parameter.

test_new_parameterset()
test_parameterset_as_string()
test_tz_aware_date_handling()

Ensure that dates are handling in a timezone-aware way.

test_tz_naive_date_handling()

Ensure that dates are handling in a timezone-aware way.

Test that LINK Parameters that can’t be resolved to a model (including non-URL values) still work.

tardis.tardis_portal.tests.test_publishservice module

class tardis.tardis_portal.tests.test_publishservice.MockRifCsProvider

Bases: tardis.tardis_portal.publish.provider.rifcsprovider.RifCsProvider

get_beamline(experiment)
get_license_uri(experiment)
get_rifcs_context(experiment)
get_template(experiment)

tardis.test_settings adds this to the template dirs: tardis/tardis_portal/tests/rifcs/

is_schema_valid(experiment)
class tardis.tardis_portal.tests.test_publishservice.PublishServiceTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

testContext()
testInitialisation()
testInitialisationNoProvider()
testManageRifCsCheckContent()
testManageRifCsCreateAndRemove()

tardis.tardis_portal.tests.test_storage module

test_storage.py http://docs.djangoproject.com/en/dev/topics/testing/

class tardis.tardis_portal.tests.test_storage.ModelTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_get_receiving_box()
test_storageboxoption()

tardis.tardis_portal.tests.test_tar_download module

class tardis.tardis_portal.tests.test_tar_download.TarDownloadTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_tar_experiment_download()

tardis.tardis_portal.tests.test_tasks module

class tardis.tardis_portal.tests.test_tasks.BackgroundTaskTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

As per: http://library.stanford.edu/iiif/image-api/compliance.html

setUp()

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

testLocalFile()
test_wrong_size_verification()

tardis.tardis_portal.tests.test_tokens module

test_tokens.py

class tardis.tardis_portal.tests.test_tokens.FrozenTime(*args, **kwargs)

Bases: object

classmethod freeze_time(time)
classmethod now()
class tardis.tardis_portal.tests.test_tokens.TokenTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_create_token(mock_webpack_get_bundle)
test_default_expiry()
test_get_session_expiry()
test_get_session_expiry_expired_token()
test_get_session_expiry_near_expiry()
test_is_expired()
test_retrieve_access_list_tokens()
test_save_with_random_token()
test_save_with_random_token_failures()
test_save_with_random_token_gives_up()
test_token_delete(mock_webpack_get_bundle)
urls = 'tardis.tardis_portal.tests.urls'

tardis.tardis_portal.tests.tests module

tests.py http://docs.djangoproject.com/en/dev/topics/testing/

class tardis.tardis_portal.tests.tests.UserInterfaceTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

test_login()
test_root(mock_webpack_get_bundle)
test_urls(mock_webpack_get_bundle)
test_urls_with_some_content(mock_webpack_get_bundle)
tardis.tardis_portal.tests.tests.suite()

tardis.tardis_portal.tests.urls module

tardis.tardis_portal.tests.urls.groups_view(request)

Dummy view for remote user tests

Module contents