tests/config_parsing.py
def historic_threshold_check_function_success(first_file_size, second_file_size,
                                              db_conn, metadata_db_conn, mocked_config, tmpdir, logger, mocked_statsd,
                                              importer_class, importer_params,
                                              threshold_config, imei_imsi=False, imei_imsi_msisdn=False,
                                              imei_custom_header='imei,reporting_date,status',
                                              import_data_file_by_path=False,
                                              import_first_data_file_path=None,
                                              import_second_data_file_path=None):
    """Helper function to test if historic thresholds are configurable.

    This function imports a first file with large size and then a smaller file succeeding
    the historic check.
    """
    # To import file from path set import_data_file_by_path to True and set both import_first_data_file_path
    # and import_second_data_file_path with the file paths.
    first_file_to_import = import_first_data_file_path if import_data_file_by_path \
        else data_file_to_test(first_file_size, imei_imsi, imei_custom_header, imei_imsi_msisdn=imei_imsi_msisdn)

    with get_importer(importer_class,
                      db_conn,
                      metadata_db_conn,
                      mocked_config.db_config,
                      tmpdir,
                      logger,
                      mocked_statsd,
                      importer_params(filename=first_file_to_import,
                                      import_size_variation_percent=threshold_config.import_size_variation_percent,
                                      import_size_variation_absolute=threshold_config.import_size_variation_absolute,
                                      extract=False)) as large_importer:
        expect_success(large_importer, first_file_size, db_conn, logger)

    second_file_to_import = import_second_data_file_path if import_data_file_by_path \
        else data_file_to_test(second_file_size, imei_imsi, imei_custom_header, imei_imsi_msisdn=imei_imsi_msisdn)

    with get_importer(importer_class,
                      db_conn,
                      metadata_db_conn,
                      mocked_config.db_config,
                      tmpdir,
                      logger,
                      mocked_statsd,
                      importer_params(filename=second_file_to_import,
                                      import_size_variation_percent=threshold_config.import_size_variation_percent,
                                      import_size_variation_absolute=threshold_config.import_size_variation_absolute,
                                      extract=False)) as small_importer:
        expect_success(small_importer, second_file_size, db_conn, logger)
Helper function to test if historic thresholds are configurable.

    This function imports a first file with large size and then a smaller file succeeding
    the historic check.
    
Helper function to test if historic thresholds are configurable.
This function imports a first file with large size and then a smaller file succeeding
the historic check.
Helper function to test if historic thresholds are configurable . This function imports a first file with large size and then a smaller file succeeding the historic check .
def historic_threshold_check_function_success(first_file_size, second_file_size,
                                              db_conn, metadata_db_conn, mocked_config, tmpdir, logger, mocked_statsd,
                                              importer_class, importer_params,
                                              threshold_config, imei_imsi=False, imei_imsi_msisdn=False,
                                              imei_custom_header='imei,reporting_date,status',
                                              import_data_file_by_path=False,
                                              import_first_data_file_path=None,
                                              import_second_data_file_path=None):
    first_file_to_import = import_first_data_file_path if import_data_file_by_path \
        else data_file_to_test(first_file_size, imei_imsi, imei_custom_header, imei_imsi_msisdn=imei_imsi_msisdn)
    with get_importer(importer_class,
                      db_conn,
                      metadata_db_conn,
                      mocked_config.db_config,
                      tmpdir,
                      logger,
                      mocked_statsd,
                      importer_params(filename=first_file_to_import,
                                      import_size_variation_percent=threshold_config.import_size_variation_percent,
                                      import_size_variation_absolute=threshold_config.import_size_variation_absolute,
                                      extract=False)) as large_importer:
        expect_success(large_importer, first_file_size, db_conn, logger)
    second_file_to_import = import_second_data_file_path if import_data_file_by_path \
        else data_file_to_test(second_file_size, imei_imsi, imei_custom_header, imei_imsi_msisdn=imei_imsi_msisdn)
    with get_importer(importer_class,
                      db_conn,
                      metadata_db_conn,
                      mocked_config.db_config,
                      tmpdir,
                      logger,
                      mocked_statsd,
                      importer_params(filename=second_file_to_import,
                                      import_size_variation_percent=threshold_config.import_size_variation_percent,
                                      import_size_variation_absolute=threshold_config.import_size_variation_absolute,
                                      extract=False)) as small_importer:
        expect_success(small_importer, second_file_size, db_conn, logger)
def historic_threshold_check_function_success ( first_file_size , second_file_size , db_conn , metadata_db_conn , mocked_config , tmpdir , logger , mocked_statsd , importer_class , importer_params , threshold_config , imei_imsi = False , imei_imsi_msisdn = False , imei_custom_header = 'imei,reporting_date,status' , import_data_file_by_path = False , import_first_data_file_path = None , import_second_data_file_path = None ) : first_file_to_import = import_first_data_file_path if import_data_file_by_path else data_file_to_test ( first_file_size , imei_imsi , imei_custom_header , imei_imsi_msisdn = imei_imsi_msisdn ) with get_importer ( importer_class , db_conn , metadata_db_conn , mocked_config . db_config , tmpdir , logger , mocked_statsd , importer_params ( filename = first_file_to_import , import_size_variation_percent = threshold_config . import_size_variation_percent , import_size_variation_absolute = threshold_config . import_size_variation_absolute , extract = False ) ) as large_importer : expect_success ( large_importer , first_file_size , db_conn , logger ) second_file_to_import = import_second_data_file_path if import_data_file_by_path else data_file_to_test ( second_file_size , imei_imsi , imei_custom_header , imei_imsi_msisdn = imei_imsi_msisdn ) with get_importer ( importer_class , db_conn , metadata_db_conn , mocked_config . db_config , tmpdir , logger , mocked_statsd , importer_params ( filename = second_file_to_import , import_size_variation_percent = threshold_config . import_size_variation_percent , import_size_variation_absolute = threshold_config . import_size_variation_absolute , extract = False ) ) as small_importer : expect_success ( small_importer , second_file_size , db_conn , logger )
Helper function to test if historic thresholds are configurable.
Helper function to test if historic thresholds are configurable .
"""Helper function to test if historic thresholds are configurable.

    This function imports a first file with large size and then a smaller file succeeding
    the historic check.
    """ # To import file from path set import_data_file_by_path to True and set both import_first_data_file_path # and import_second_data_file_path with the file paths.
first_file_size
second_file_size
db_conn
metadata_db_conn
mocked_config
tmpdir
logger
mocked_statsd
importer_class
importer_params
threshold_config
imei_imsi
imei_imsi_msisdn
imei_custom_header
import_data_file_by_path
import_first_data_file_path
import_second_data_file_path