lomas_server.tests package

Submodules

lomas_server.tests.constants module

lomas_server.tests.test_api module

class lomas_server.tests.test_api.TestRootAPIEndpoint(methodName='runTest')[source]

Bases: TestSetupRootAPIEndpoint

End-to-end tests of the api endpoints.

test_get_dataset_metadata() None[source]

Test_get_dataset_metadata.

test_get_dummy_dataset() None[source]

Test_get_dummy_dataset.

test_get_initial_budget() None[source]

Test_get_initial_budget.

test_get_previous_queries() None[source]

Test_get_previous_queries.

test_get_remaining_budget() None[source]

Test_get_remaining_budget.

test_get_total_spent_budget() None[source]

Test_get_total_spent_budget.

test_root() None[source]

Test root endpoint redirection to state endpoint.

test_state() None[source]

Test state endpoint.

test_subsequent_budget_limit_logic() None[source]

Test_subsequent_budget_limit_logic.

test_unknown_endpoint() None[source]

Test endpoint that does not exist.

lomas_server.tests.test_api_diffprivlib module

class lomas_server.tests.test_api_diffprivlib.TestDiffPrivLibEndpoint(methodName='runTest')[source]

Bases: TestSetupRootAPIEndpoint

Test DiffPrivLib Endpoint with different models.

test_clustering_models() None[source]

Test diffprivlib query: K-Means.

test_diffprivlib_compatibility_error() None[source]

Test diffprivlib compatibility error.

test_diffprivlib_cost() None[source]

Test_diffprivlib_cost.

test_diffprivlib_privacy_leak() None[source]

Test diffprivlib privacy leak error.

test_diffprivlib_query() None[source]

Test diffprivlib query.

test_dimension_reduction_models() None[source]

Test diffprivlib query: PCA.

test_dummy_diffprivlib_query() None[source]

Test_dummy_diffprivlib_query.

test_linear_regression_models() None[source]

Test diffprivlib query: Linear Regression.

test_linear_regression_models_same_columns() None[source]

Test diffprivlib query: Same columns.

test_logistic_regression_models() None[source]

Test diffprivlib query: Logistic Regression.

test_naives_bayes_model() None[source]

Test diffprivlib query: Gaussian Naives Bayes.

test_trees_models() None[source]

Test diffprivlib query: Random Forest, Decision Tree.

lomas_server.tests.test_api_diffprivlib.validate_pipeline(client, response) QueryResponse[source]

Validate that the pipeline ran successfully.

Returns a model and a score.

lomas_server.tests.test_api_smartnoise_synth module

class lomas_server.tests.test_api_smartnoise_synth.TestSmartnoiseSynthEndpoint(methodName='runTest')[source]

Bases: TestSetupRootAPIEndpoint

Test Smartnoise Synth Endpoints with different Synthesizers.

test_dummy_smartnoise_synth_query() None[source]

Test_dummy_smartnoise_synth_query.

test_smartnoise_synth_cost() None[source]

Test_smartnoise_synth_cost.

test_smartnoise_synth_query() None[source]

Test smartnoise synth query.

test_smartnoise_synth_query_aim() None[source]

Test smartnoise synth query AIM Synthesizer.

test_smartnoise_synth_query_constraints() None[source]

Test smartnoise synth query constraints.

test_smartnoise_synth_query_datetime() None[source]

Test smartnoise synth query on other dataset for datetime columns.

test_smartnoise_synth_query_delta_none() None[source]

Test smartnoise synth query on other synthesizer with delta None.

test_smartnoise_synth_query_dpgan() None[source]

Test smartnoise synth query dpgan Synthesizer.

test_smartnoise_synth_query_mst() None[source]

Test smartnoise synth query MST Synthesizer.

test_smartnoise_synth_query_mwem() None[source]

Test smartnoise synth query MWEM Synthesizer.

test_smartnoise_synth_query_pacsynth() None[source]

Test smartnoise synth query PAC-Synth Synthesizer.

TOO UNSTABLE BECAUSE OF RUST PANIC

test_smartnoise_synth_query_patectgan() None[source]

Test smartnoise synth query PATE-CTGAN Synthesizer.

test_smartnoise_synth_query_pategan() None[source]

Test smartnoise synth query pategan Synthesizer.

test_smartnoise_synth_query_private_id() None[source]

Test smartnoise synth query on other dataset for private id.

and categorical int columns

test_smartnoise_synth_query_samples() None[source]

Test smartnoise synth query return samples.

test_smartnoise_synth_query_select_cols() None[source]

Test smartnoise synth query select_cols.

lomas_server.tests.test_api_smartnoise_synth.validate_response(client, response, headers=None) QueryResponse[source]

Validate that the pipeline ran successfully.

Returns a model and a score.

lomas_server.tests.test_collection_models module

class lomas_server.tests.test_collection_models.TestMetadataModel(methodName='runTest')[source]

Bases: TestCase

Tests for the input validation of dataset metadata.

test_boolean_column() None[source]

Test_boolean_column.

test_categories() None[source]

Test categories validation.

test_categories_match_cardinality() None[source]

Test categories match cardinality.

test_categories_match_type() None[source]

Test categories match column type.

test_categories_required() None[source]

Test categories required.

test_datetime_column() None[source]

Test_datetime_column.

test_float_column() None[source]

Test_float_column.

test_int_column() None[source]

Test_int_column.

test_lower_upper_bounded() None[source]

Test lower is smaller than upper and of right type.

test_metadata_columns_discriminator() None[source]

Test metadata column discriminator.

test_precision() None[source]

Test precision can only be 32 or 64.

test_standard_metadata_fields() None[source]

Test standard metadata fields.

lomas_server.tests.test_dummy_generation module

class lomas_server.tests.test_dummy_generation.TestMakeDummyDataset(methodName='runTest')[source]

Bases: TestCase

Tests for the generation of dummy datasets.

metadata: ClassVar[dict[str, Any]] = {'columns': {}, 'max_ids': 1, 'row_privacy': True, 'rows': 100}
test_boolean_column() None[source]

Test_boolean_column.

test_categorical_column() None[source]

Test_categorical_column.

test_datetime_column() None[source]

Test_datetime_column.

test_float_column() None[source]

Test_float_column.

test_int_column() None[source]

Test_int_column.

test_nullable_column() None[source]

Test_nullable_column.

test_seed() None[source]

Test_seed.

lomas_server.tests.test_mongodb_admin module

class lomas_server.tests.test_mongodb_admin.TestMongoDBAdmin(methodName='runTest')[source]

Bases: TestCase

Tests for the functions in mongodb_admin.py.

This is an integration test and requires a mongodb database to be started before being executed.

setUp() None[source]

Connection to database.

tearDown() None[source]

Drop all data from database.

test_add_dataset_to_user() None[source]

Test add dataset to a user.

test_add_datasets_via_yaml() None[source]

Test add datasets via a YAML file.

test_add_demo_data_to_mongodb_admin() None[source]

Test add demo data to admin db.

test_add_local_dataset() None[source]

Test adding a local dataset.

test_add_s3_dataset() None[source]

Test adding a dataset stored on S3.

test_add_s3_datasets_via_yaml() None[source]

Test add datasets via a YAML file.

test_add_user() None[source]

Test adding a user.

test_add_user_wb() None[source]

Test adding a user with a dataset.

test_add_users_via_yaml() None[source]

Test create user collection via YAML file.

test_del_dataset() None[source]

Test dataset deletion.

test_del_dataset_to_user() None[source]

Test delete dataset from user.

test_del_user() None[source]

Test deleting a user.

test_drop_collection() None[source]

Test drop collection from db.

test_get_archives_of_user() None[source]

Test show archives of user.

test_get_collection() None[source]

Test show collection from db.

test_get_dataset() None[source]

Test show dataset.

test_get_list_of_datasets() None[source]

Test get list of datasets.

test_get_list_of_datasets_from_users() None[source]

Test get list of datasets from users.

test_get_list_of_users() None[source]

Test get list of users.

test_get_metadata_of_dataset() None[source]

Test show metadata_dataset.

test_get_user() None[source]

Test show user.

test_set_budget_field() None[source]

Test setting a budget field.

test_set_may_query() None[source]

Test set may query.

update_dataset_paths(dataset: dict) dict[source]

Update dataset paths with prefix.

Helper function that takes a dataset yaml, parses it and updates all the file paths with the prefix to the test data directory.

Parameters:

dataset (dict) – Dataset yaml.

Returns:

Dataset yaml with updated paths.

Return type:

dict

lomas_server.tests.test_mongodb_admin_cli module

Module contents