twarc2sql.db_utils.tests package

Submodules

twarc2sql.db_utils.tests.test_db_access module

Tests for the db_access module.

The tests are run using pytest. To run the tests, use the following command from the root directory of the project:

pytest twarc2sql/db_utils/tests/test_db_access.py

twarc2sql.db_utils.tests.test_db_access.test_create_db(config_file_path)[source]

Test that the create_engine function returns an engine.

The engine should be a sqlalchemy.engine.base.Engine object.

twarc2sql.db_utils.tests.test_db_access.test_create_db_with_tables(config_file_path, tables_and_columns)[source]

Test that the create_db_with_tables function returns an engine.

The engine should be a sqlalchemy.engine.base.Engine object.

twarc2sql.db_utils.tests.test_db_access.test_create_engine(config_file_path, uri)[source]

Test that the create_engine function returns an engine.

The engine should be a sqlalchemy.engine.base.Engine object.

twarc2sql.db_utils.tests.test_db_access.test_create_tables(engine, base_tables, tables_and_columns)[source]

Test that the create_tables function returns True.

The function should return True if the tables are created.

twarc2sql.db_utils.tests.test_db_access.test_create_uri(uri)[source]

Test that the create_uri function returns the correct URI.

The URI should be in the format: postgresql://user:password@host:port/db_name

twarc2sql.db_utils.tests.test_db_access.test_delete_db(config_file_path)[source]

Test that the delete_db function returns True.

The function should return True if the database is deleted.

twarc2sql.db_utils.tests.test_db_access.test_get_engine(config_file_path)[source]

Test that the get_engine function returns an engine.

The engine should be a sqlalchemy.engine.base.Engine object.

twarc2sql.db_utils.tests.test_db_access.test_load_db_config()[source]

Test that the load_db_config function returns a dictionary.

The dictionary should contain the correct keys and values.

twarc2sql.db_utils.tests.test_db_access.test_load_db_config_missing_file()[source]

Test that the load_db_config function raises an error for following cases.

  • file_path does not exist.

Module contents

Tests for the twarc2sql.db_utils module.