academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope

Module Contents

Classes

OrcidTestRecords

TestOrcidTelescope

Tests for the ORCID telescope

TestOrcidBatch

A class whose instances are single test cases.

TestCreateOrcidBatchManifest

TestCreateOrcidBatchManifest

TestTransformOrcidRecord

A class whose instances are single test cases.

TestExtras

A class whose instances are single test cases.

Attributes

FIXTURES_FOLDER

academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.FIXTURES_FOLDER[source]
class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.OrcidTestRecords[source]
first_run_folder[source]
first_run_records[source]
first_run_main_table[source]
second_run_folder[source]
second_run_records[source]
second_run_main_table[source]
upsert_table[source]
delete_table[source]
invalid_key_orcid[source]
mismatched_orcid[source]
timestamp_fields = ['submission_date', 'last_modified_date', 'created_date'][source]
class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.TestOrcidTelescope(*args, **kwargs)[source]

Bases: observatory.platform.observatory_environment.ObservatoryTestCase

Tests for the ORCID telescope

test_dag_structure()[source]

Test that the DAG has the correct structure.

test_dag_load()[source]

Test that workflow can be loaded from a DAG bag.

test_telescope()[source]

Test the ORCID workflow end to end.

class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.TestOrcidBatch(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

test_orcid_batch()[source]

Test that the orcid batches are correctly constructed

class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.TestCreateOrcidBatchManifest[source]

Bases: observatory.platform.observatory_environment.ObservatoryTestCase

dag_id = 'orcid'[source]
aws_key = ()[source]
aws_region_name[source]
test_create_orcid_batch_manifest()[source]

Tests the create_orcid_batch_manifest function

class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.TestCreateOrcidBatchManifest(*args, **kwargs)[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

test_create_orcid_batch_manifest()[source]

Tests that the manifest file is created with the correct header and contains the correct blob names and modification dates

test_no_results()[source]

Tests that the manifest file is not created if there are no blobs modified after the reference date

class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.TestTransformOrcidRecord(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

test_valid_record()[source]

Tests that a valid ORCID record with ‘record’ section is transformed correctly

test_error_record()[source]

Tests that an ORCID record with ‘error’ section is transformed correctly

test_invalid_key_record()[source]

Tests that an ORCID record with no ‘error’ or ‘record’ section raises a Key Error

test_mismatched_orcid()[source]

Tests that a ValueError is raised if the ORCID in the file name does not match the ORCID in the record

class academic_observatory_workflows.orcid_telescope.tests.test_orcid_telescope.TestExtras(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

test_latest_modified_record_date()[source]

Tests that the latest_modified_record_date function returns the correct date

test_orcid_batch_names()[source]

Tests that the orcid_batch_names function returns the expected results