tardis.tardis_portal.tests package

Submodules

tardis.tardis_portal.tests.ldap_ldif module

tardis.tardis_portal.tests.mock_vbl_auth module

Created on 24/01/2011

@author: gerson

class tardis.tardis_portal.tests.mock_vbl_auth.MockBackend

Authenticate against the VBL SOAP Webservice. It is assumed that the request object contains the username and password to be provided to the VBLgetExpIDs function.

a new local user is created if it doesn’t already exist

if the authentication succeeds, the session will contain a VBL session key used for downloads as well as the user’s EPN list

authenticate(request)
get_user(user_id)

tardis.tardis_portal.tests.mock_vbl_download module

tardis.tardis_portal.tests.mock_vbl_download.download_datafile(request, *args, **kwargs)

Dummy view for vbl download tests

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

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/latest/tardis/tardis_portal/tests/ldap_schemas/'
PATH_SLAPD = None
PATH_SLAPTEST = None
PATH_TMPDIR = '/tmp/tmpuihH9H'
TEST_UTILS_DIR = '/home/docs/checkouts/readthedocs.org/user_builds/mytardis/checkouts/latest/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.

testCreateNewAccount()
testManageAuthMethods()
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()
testChangeUserPermissions()
testOwnedExperiments()
testReadAccess()
testWriteAccess()
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
authenticate(request)
class tardis.tardis_portal.tests.test_authservice.MockGroupProvider

Bases: tardis.tardis_portal.auth.interfaces.GroupProvider

getGroupById(id)
getGroups(user)
getGroupsForEntity(id)
searchGroups(**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_collectstatic module

class tardis.tardis_portal.tests.test_collectstatic.CollectstaticTest(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_collectstatic()

tardis.tardis_portal.tests.test_createuser module

class tardis.tardis_portal.tests.test_createuser.CreateUserTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

testInteractive()

Just test that we can run ./manage.py createuser without any runtime exceptions by mocking the raw_input username and email entry

testNoInput()

Just test that we can run ./manage.py createuser –username testuser1 –email testuser1@example.com –noinput without any runtime exceptions

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()
testView()
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_dumpschemas module

class tardis.tardis_portal.tests.test_dumpschemas.DumpSchemasTestCase(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.

testDumpSchemas()

Just test that we can run ./manage.py dumpschemas without any runtime exceptions

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()
test_needs_confirmation()

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_loadschemas module

class tardis.tardis_portal.tests.test_loadschemas.LoadSchemasTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

testLoadSchemas()

Test that we can run ./manage.py loadschemas tardis/tardis_portal/fixtures/jeol_metadata_schema.json

tardis.tardis_portal.tests.test_models module

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

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

Bases: django.test.testcases.TestCase

setUp()

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

test_authors()
test_create_user_automatically_generate_api_key()
test_datafile()
test_dataset()
test_deleting_dfo_without_uri()
test_experiment()
test_instrument()
test_parameter()

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_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)
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_rmexperiment module

class tardis.tardis_portal.tests.test_rmexperiment.RmExperimentTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

testList()
testRemove()

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)
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()
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()
urls = 'tardis.tardis_portal.tests.urls'

tardis.tardis_portal.tests.test_views module

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

class tardis.tardis_portal.tests.test_views.ContextualViewTest(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

setting up essential objects, copied from tests above

tearDown()

Hook method for deconstructing the test fixture after testing it.

testDetailsDisplay()

test display of view for an existing schema and no display for an undefined one.

class tardis.tardis_portal.tests.test_views.ExperimentListsTest(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

setting up essential objects, copied from tests above

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_mydata_view()

Test My Data view

test_shared_view()

Test Shared view

class tardis.tardis_portal.tests.test_views.ExperimentTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

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

testCreateAndEdit()
testDatasetJson()
class tardis.tardis_portal.tests.test_views.ManageAccountTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

testManageAccount()
class tardis.tardis_portal.tests.test_views.RightsTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

testRightsRequireValidOwner()
class tardis.tardis_portal.tests.test_views.UploadTestCase(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.

testFileUpload()
testUploadComplete()
class tardis.tardis_portal.tests.test_views.UserListTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

User lists are used for autocompleting the user-to-share-with field when granting access to an experiment

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

testGetUserList()
class tardis.tardis_portal.tests.test_views.ViewTemplateContextsTest(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()

setting up essential objects, copied from tests above

tearDown()

Hook method for deconstructing the test fixture after testing it.

testDatasetView()

test some context parameters for a dataset view

testExperimentView()

test some template context parameters for an experiment view

class tardis.tardis_portal.tests.test_views.listTestCase(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.

testGetGroupList()
testGetUserList()

tardis.tardis_portal.tests.tests module

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

class tardis.tardis_portal.tests.tests.SearchTestCase(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.

testSearchExperimentAuthentication(**kwargs)
testSearchExperimentForm(**kwargs)
testSearchExperimentResults(**kwargs)
class tardis.tardis_portal.tests.tests.UserInterfaceTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

test_login()
test_root()
test_search_urls(**kwargs)
test_urls()
test_urls_with_some_content()
tardis.tardis_portal.tests.tests.suite()

tardis.tardis_portal.tests.urls module

Module contents