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

test_ands_doi.py

class tardis.tardis_portal.tests.test_ands_doi.ANDSDOITestCase(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_doi_none()
test_init()

tardis.tardis_portal.tests.test_api module

Testing the tastypie-based mytardis api

class tardis.tardis_portal.tests.test_api.ACLAuthorizationTest(methodName='runTest')

Bases: django.test.testcases.TestCase

class tardis.tardis_portal.tests.test_api.DataFileResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

setUp()

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

test_post_single_file()
test_shared_fs_many_files()

tests sending many files with known permanent location (useful for Australian Synchrotron ingestions)

test_shared_fs_single_file()
class tardis.tardis_portal.tests.test_api.DatafileParameterResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.DatafileParameterSetResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.DatasetParameterResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.DatasetParameterSetResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.DatasetResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

setUp()

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

test_get_dataset_filter_instrument()
test_get_dataset_no_instrument()
test_get_dataset_with_instrument()
test_post_dataset()
class tardis.tardis_portal.tests.test_api.ExperimentParameterResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.ExperimentParameterSetResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.ExperimentResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

setUp()

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

test_get_experiment()
test_post_experiment()
class tardis.tardis_portal.tests.test_api.FacilityResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

test_get_facility_by_id()
test_get_facility_by_manager_group_id()

This type of query can be used to iterate through a user’s groups, and use each group’s id to determine which facilities a user manages, i.e. a way to obtain the functionality implemented by

tardis.tardis_portal.models.facility.facilities_managed_by

via the API

test_get_facility_by_name()
class tardis.tardis_portal.tests.test_api.GroupResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

test_get_group_by_id()
test_get_group_by_name()
class tardis.tardis_portal.tests.test_api.InstrumentResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

test_get_instrument_by_id()
test_get_instrument_by_name()
test_post_instrument()
test_rename_instrument()
class tardis.tardis_portal.tests.test_api.LocationResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.MyTardisAuthenticationTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

test_apikey_authentication()
test_bad_credentials()
class tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase(methodName='runTest')

Bases: tastypie.test.ResourceTestCase

abstract class without tests to combine common settings in one place

get_apikey_credentials()
get_credentials()
setUp()

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

class tardis.tardis_portal.tests.test_api.ReplicaResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.SchemaResourceTest(methodName='runTest')

Bases: tardis.tardis_portal.tests.test_api.MyTardisResourceTestCase

class tardis.tardis_portal.tests.test_api.SerializerTest(methodName='runTest')

Bases: django.test.testcases.TestCase

test_debug_serializer()
test_pretty_serializer()

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.

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

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

class tardis.tardis_portal.tests.test_fetcher.PrivilegedOpenerTestCase(methodName='runTest')

Bases: django.test.testcases.TestCase

classmethod setUpClass()

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()

Hook method for deconstructing the class fixture after running all tests in the class.

testCredentials()

Test that the walker manages credentials.

class tardis.tardis_portal.tests.test_fetcher.TestWebServer

Utility class for running a test web server with a given handler.

class QuietSimpleHTTPRequestHandler(request, client_address, server)

Bases: SimpleHTTPServer.SimpleHTTPRequestHandler

Simple subclass that only prints output to STDOUT, not STDERR

do_GET()
log_message(msg, *args)
class ThreadedTCPServer(server_address, RequestHandlerClass, bind_and_activate=True)

Bases: SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer

classmethod getPort()
getUrl()
start()
stop()

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_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_parameter()

tardis.tardis_portal.tests.test_parametersetmanager module

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

class tardis.tardis_portal.tests.test_parametersetmanager.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_staging module

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

class tardis.tardis_portal.tests.test_staging.TestStagingFiles(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_stage_replica()

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_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_default_expiry()
test_get_session_expiry()
test_get_session_expiry_expired_token()
test_get_session_expiry_near_expiry()
test_is_expired()
test_save_with_random_token()
test_save_with_random_token_failures()
test_save_with_random_token_gives_up()
urls = 'tardis.tardis_portal.tests.urls'

tardis.tardis_portal.tests.test_views module

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.

testSearchDatafileAuthentication(**kwargs)
testSearchDatafileForm(**kwargs)
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