academic_observatory_workflows.doi_workflow.tests.test_doi_workflow

Module Contents

Classes

TestDoiWorkflow

Tests for the functions used by the Doi workflow

Functions

query_table(→ List[Dict])

Query a BigQuery table, sorting the results and returning results as a list of dicts.

Attributes

FIXTURES_FOLDER

academic_observatory_workflows.doi_workflow.tests.test_doi_workflow.FIXTURES_FOLDER[source]
academic_observatory_workflows.doi_workflow.tests.test_doi_workflow.query_table(table_id: str, order_by_field: str) List[Dict][source]

Query a BigQuery table, sorting the results and returning results as a list of dicts.

Parameters:
  • table_id – the table id.

  • order_by_field – what field or fields to order by.

Returns:

the table rows.

class academic_observatory_workflows.doi_workflow.tests.test_doi_workflow.TestDoiWorkflow(*args, **kwargs)[source]

Bases: observatory.platform.observatory_environment.ObservatoryTestCase

Tests for the functions used by the Doi workflow

test_fetch_ror_affiliations()[source]

Test fetch_ror_affiliations

test_dag_structure()[source]

Test that the DOI DAG has the correct structure.

test_dag_load()[source]

Test that the DOI can be loaded from a DAG bag.

Returns:

None

test_ror_to_ror_hierarchy_index()[source]

Test ror_to_ror_hierarchy_index. Check that correct ancestor relationships created.

update_db(*, session, object)[source]
add_dummy_dag_model(*, tmp_dir: str, dag_id: str, schedule: str)[source]
test_telescope()[source]

Test the DOI telescope end to end.

assert_aggregate(expected: List[Dict], actual: List[Dict])[source]

Assert an aggregate table.

Parameters:
  • expected – the expected rows.

  • actual – the actual rows.

Returns:

None.

assert_sub_fields(expected: Dict, actual: Dict, field: str, sub_fields: List[str])[source]

Checks that the sub fields in the aggregate match.

Parameters:
  • expected – the expected item.

  • actual – the actual item.

  • field – the field name.

  • sub_fields – the sub field name.

Returns:

assert_doi(expected: List[Dict], actual: List[Dict])[source]

Assert the DOI table.

Parameters:
  • expected – the expected DOI table rows.

  • actual – the actual DOI table rows.

Returns:

None.

assert_doi_events(expected: Dict, actual: Dict)[source]

Assert the DOI table events field.

Parameters:
  • expected – the expected events field.

  • actual – the actual events field.

Returns:

None

assert_doi_affiliations(expected: Dict, actual: Dict)[source]

Assert DOI affiliations.

Parameters:
  • expected – the expected DOI affiliation rows.

  • actual – the actual DOI affiliation rows.

Returns:

None.

assert_doi_affiliation(expected: Dict, actual: Dict, key: str)[source]

Assert a DOI affiliation row.

Parameters:
  • expected – the expected DOI affiliation row.

  • actual – the actual DOI affiliation row.

Returns:

None.