def test_historical_check_percentage(pairing_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID 96662/5. Verify that pairing list data is not imported if it fails the historical check. """ expect_success(pairing_list_importer, 5, db_conn, logger) # size increased, the importer succeeds. with get_importer(PairingListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, PairListParams(filename='sample_pairing_list_large.csv', import_size_variation_percent=mocked_config.pairing_threshold_config. import_size_variation_percent, import_size_variation_absolute=mocked_config.pairing_threshold_config. import_size_variation_absolute)) as imp: expect_success(imp, 99, db_conn, logger) # importing file with drop in size greater than 5% with get_importer(PairingListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, PairListParams(filename=data_file_to_test(90, imei_imsi=True), import_size_variation_percent=mocked_config.pairing_threshold_config. import_size_variation_percent, import_size_variation_absolute=mocked_config.pairing_threshold_config. import_size_variation_absolute)) as imp: expect_failure(imp, exc_message='Failed import size historic check') # importing file with drop in size less than 5% with get_importer(PairingListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, PairListParams(filename=data_file_to_test(95, imei_imsi=True), import_size_variation_percent=mocked_config.pairing_threshold_config. import_size_variation_percent, import_size_variation_absolute=mocked_config.pairing_threshold_config. import_size_variation_absolute)) as imp: expect_success(imp, 95, db_conn, logger)
def test_historical_check_percentage_succeeds(registration_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID not known yet. Verify that a local import data is successfully imported after having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(registration_list_importer, 100, db_conn, logger) with get_importer( RegistrationListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, RegistrationListParams( filename=data_file_to_test(80, imei_custom_header='approved_imei,' 'make,model,' 'status,model_number,' 'brand_name,device_type,' 'radio_interface,' 'device_id'), import_size_variation_percent=mocked_config. import_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. import_threshold_config.import_size_variation_absolute) ) as imp: expect_success(imp, 80, db_conn, logger)
def test_historical_check_percentage_succeeds(stolen_list_importer, logger, mocked_statsd, db_conn, mocked_config, metadata_db_conn, tmpdir): """Test Depot ID not known yet. Verify that a local stolen data is successfully imported after having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(stolen_list_importer, 100, db_conn, logger) with get_importer( StolenListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, StolenListParams( filename=data_file_to_test( 80, imei_custom_header='imei,reporting_date,' 'status', imei_imsi=False), import_size_variation_percent=mocked_config. stolen_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. stolen_threshold_config.import_size_variation_absolute) ) as imp: expect_success(imp, 80, db_conn, logger)
def test_historical_check_1000(pairing_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID not known yet. Historical pairing list check failed greater than 5% drop in import size 1000000 down to 98000. """ expect_success(pairing_list_importer, 1000, db_conn, logger) with get_importer( PairingListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, PairListParams(filename=data_file_to_test( 900, imei_imsi_msisdn=True))) as imp: expect_failure(imp)
def test_historical_check_percent_succeeds(monitoring_list_importer, logger, mocked_statsd, db_conn, mocked_config, metadata_db_conn, tmpdir): """Verify that a local monitoring data is successfully imported. After having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(monitoring_list_importer, 100, db_conn, logger) with get_importer( MonitoringListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, MonitoringListParams( filename=data_file_to_test(80, imei_custom_header='imei', imei_imsi=False), import_size_variation_percent=mocked_config. barred_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. barred_threshold_config.import_size_variation_absolute) ) as imp: expect_success(imp, 80, db_conn, logger)
filename='sample_registration_list_historicalcheck.csv', import_size_variation_percent=mocked_config. import_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. import_threshold_config.import_size_variation_absolute) ) as imp: expect_failure(imp, exc_message='Failed import size historic check') @pytest.mark.parametrize('registration_list_importer', [ RegistrationListParams( filename=data_file_to_test(100, imei_custom_header='approved_imei,' 'make,model,' 'status,' 'model_number,' 'brand_name,' 'device_type,' 'radio_interface,' 'device_id')) ], indirect=True) def test_historical_check_percentage_succeeds(registration_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID not known yet. Verify that a local import data is successfully imported after having imported two files where the second file has 80% size of the first one and the threshold value is 75. """
Verify that the user can override historical checks when importing pairing list data. """ expect_success(pairing_list_importer, 5, db_conn, logger) with get_importer( PairingListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, PairListParams(filename='sample_pairinglist_historial_check.csv', perform_historic_check=False)) as imp: expect_success(imp, 0, db_conn, logger) @pytest.mark.parametrize( 'pairing_list_importer', [PairListParams(filename=data_file_to_test(1000, imei_imsi_msisdn=True))], indirect=True) def test_historical_check_1000(pairing_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID not known yet. Historical pairing list check failed greater than 5% drop in import size 1000000 down to 98000. """ expect_success(pairing_list_importer, 1000, db_conn, logger) with get_importer( PairingListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, PairListParams(filename=data_file_to_test( 900, imei_imsi_msisdn=True))) as imp: expect_failure(imp)
expect_success(monitoring_list_importer, 20, db_conn, logger) with get_importer( MonitoringListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, MonitoringListParams( filename='sample_monitoring_list_historicalcheck.csv', import_size_variation_percent=mocked_config. barred_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. barred_threshold_config.import_size_variation_absolute) ) as imp: expect_failure(imp, exc_message='Failed import size historic check') @pytest.mark.parametrize('monitoring_list_importer', [ MonitoringListParams(filename=data_file_to_test( 100, imei_custom_header='imei', imei_imsi=False)) ], indirect=True) def test_historical_check_percent_succeeds(monitoring_list_importer, logger, mocked_statsd, db_conn, mocked_config, metadata_db_conn, tmpdir): """Verify that a local monitoring data is successfully imported. After having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(monitoring_list_importer, 100, db_conn, logger) with get_importer( MonitoringListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, MonitoringListParams(
with get_importer( GoldenListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, GoldenListParams( filename='sample_golden_list_historicalcheck.csv', import_size_variation_percent=mocked_config. golden_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. golden_threshold_config.import_size_variation_absolute) ) as imp: expect_failure(imp, exc_message='Failed import size historic check') @pytest.mark.parametrize('golden_list_importer', [ GoldenListParams(filename=data_file_to_test( 100, imei_imsi=False, imei_custom_header='golden_imei')) ], indirect=True) def test_historical_check_percentage_succeeds(golden_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID not known yet. Verify that a local golden data is successfully imported after having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(golden_list_importer, 100, db_conn, logger) with get_importer( GoldenListImporter, db_conn, metadata_db_conn,
StolenListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, StolenListParams( filename='sample_stolen_list_historicalcheck.csv', import_size_variation_percent=mocked_config. stolen_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. stolen_threshold_config.import_size_variation_absolute) ) as imp: expect_failure(imp, exc_message='Failed import size historic check') @pytest.mark.parametrize('stolen_list_importer', [ StolenListParams( filename=data_file_to_test(100, imei_custom_header='imei,reporting_date,' 'status', imei_imsi=False)) ], indirect=True) def test_historical_check_percentage_succeeds(stolen_list_importer, logger, mocked_statsd, db_conn, mocked_config, metadata_db_conn, tmpdir): """Test Depot ID not known yet. Verify that a local stolen data is successfully imported after having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(stolen_list_importer, 100, db_conn, logger) with get_importer(
with get_importer( RegistrationListImporter, db_conn, metadata_db_conn, mocked_config.db_config, tmpdir, logger, mocked_statsd, RegistrationListParams( filename='sample_registration_list_historicalcheck.csv', import_size_variation_percent=mocked_config. import_threshold_config.import_size_variation_percent, import_size_variation_absolute=mocked_config. import_threshold_config.import_size_variation_absolute) ) as imp: expect_failure(imp, exc_message='Failed import size historic check') @pytest.mark.parametrize('registration_list_importer', [ RegistrationListParams(filename=data_file_to_test( 100, imei_custom_header='approved_imei,' 'make,model,' 'status')) ], indirect=True) def test_historical_check_percentage_succeeds(registration_list_importer, logger, mocked_statsd, db_conn, metadata_db_conn, mocked_config, tmpdir): """Test Depot ID not known yet. Verify that a local import data is successfully imported after having imported two files where the second file has 80% size of the first one and the threshold value is 75. """ expect_success(registration_list_importer, 100, db_conn, logger) with get_importer(