tests/_delta_helpers.py
def delta_add_same_entries_common(db_conn, tmpdir, mocked_config, importer_name, historic_tbl_name):
    """Common code to verify that is possible to add in delta list.

    An info message is generated and only the first row gets inserted into historic table.
    """
    # write into csv
    csv_imei_change_type_tuples = [('12345678901243', 'add'), ('12345678901243', 'add')]
    valid_zip_import_data_file_path = write_import_csv(tmpdir, importer_name, csv_imei_change_type_tuples)
    runner = CliRunner()
    result = runner.invoke(dirbs_import_cli, [importer_name, '--delta', valid_zip_import_data_file_path],
                           obj={'APP_CONFIG': mocked_config})
    assert result.exit_code == 0
    count, res = fetch_tbl_rows(historic_tbl_name, db_conn)
    assert count == 1
    imei_one = '12345678901243'
    imei_norm_pk_name = 'imei_norm'
    if importer_name == 'golden_list':
        imei_one = imeis_md5_hashing_uuid(imei_one, convert_to_uuid=True)
        imei_norm_pk_name = 'hashed_imei_norm'
    imei_norm_set = {getattr(r, imei_norm_pk_name) for r in res}
    assert imei_norm_set == {imei_one}
Common code to verify that is possible to add in delta list.

    An info message is generated and only the first row gets inserted into historic table.
    
Common code to verify that is possible to add in delta list.
An info message is generated and only the first row gets inserted into historic table.
Common code to verify that is possible to add in delta list . An info message is generated and only the first row gets inserted into historic table .
def delta_add_same_entries_common(db_conn, tmpdir, mocked_config, importer_name, historic_tbl_name):
    csv_imei_change_type_tuples = [('12345678901243', 'add'), ('12345678901243', 'add')]
    valid_zip_import_data_file_path = write_import_csv(tmpdir, importer_name, csv_imei_change_type_tuples)
    runner = CliRunner()
    result = runner.invoke(dirbs_import_cli, [importer_name, '--delta', valid_zip_import_data_file_path],
                           obj={'APP_CONFIG': mocked_config})
    assert result.exit_code == 0
    count, res = fetch_tbl_rows(historic_tbl_name, db_conn)
    assert count == 1
    imei_one = '12345678901243'
    imei_norm_pk_name = 'imei_norm'
    if importer_name == 'golden_list':
        imei_one = imeis_md5_hashing_uuid(imei_one, convert_to_uuid=True)
        imei_norm_pk_name = 'hashed_imei_norm'
    imei_norm_set = {getattr(r, imei_norm_pk_name) for r in res}
    assert imei_norm_set == {imei_one}
def delta_add_same_entries_common ( db_conn , tmpdir , mocked_config , importer_name , historic_tbl_name ) : csv_imei_change_type_tuples = [ ( '12345678901243' , 'add' ) , ( '12345678901243' , 'add' ) ] valid_zip_import_data_file_path = write_import_csv ( tmpdir , importer_name , csv_imei_change_type_tuples ) runner = CliRunner ( ) result = runner . invoke ( dirbs_import_cli , [ importer_name , '--delta' , valid_zip_import_data_file_path ] , obj = { 'APP_CONFIG' : mocked_config } ) assert result . exit_code == 0 count , res = fetch_tbl_rows ( historic_tbl_name , db_conn ) assert count == 1 imei_one = '12345678901243' imei_norm_pk_name = 'imei_norm' if importer_name == 'golden_list' : imei_one = imeis_md5_hashing_uuid ( imei_one , convert_to_uuid = True ) imei_norm_pk_name = 'hashed_imei_norm' imei_norm_set = { getattr ( r , imei_norm_pk_name ) for r in res } assert imei_norm_set == { imei_one }
Common code to verify that is possible to add in delta list.
Common code to verify that is possible to add in delta list .
"""Common code to verify that is possible to add in delta list.

    An info message is generated and only the first row gets inserted into historic table.
    """ # write into csv
db_conn
tmpdir
mocked_config
importer_name
historic_tbl_name