@@ -0,0 +1,1465 @@
+from collections import OrderedDict%0Aimport csv%0Aimport os%0Afrom unittest.mock import Mock%0A%0Aimport pytest%0Afrom pytest import raises%0A%0Afrom dataactcore.utils import jobQueue%0Afrom dataactcore.config import CONFIG_BROKER%0Afrom dataactcore.utils.responseException import ResponseException%0A%0A%0Adef read_f_file_rows(suffix, file_path):%0A    jobQueue.generate_f_file(1, 1, Mock(), suffix, suffix, is_local=True)%0A%0A    assert os.path.isfile(file_path)%0A%0A    with open(file_path) as f:%0A        return %5Brow for row in csv.reader(f)%5D%0A%0A%0Adef test_generate_f_file(monkeypatch, mock_broker_config_paths):%0A    %22%22%22A CSV with fields in the right order should be written to the file%0A    system%22%22%22%0A    fileF_mock = Mock()%0A    monkeypatch.setattr(jobQueue, 'fileF', fileF_mock)%0A    fileF_mock.generateFRows.return_value = %5B%0A        dict(key4='a', key11='b'), dict(key4='c', key11='d')%0A    %5D%0A%0A    fileF_mock.mappings = OrderedDict(%0A        %5B('key4', 'mapping4'), ('key11', 'mapping11')%5D)%0A    file_path = str(mock_broker_config_paths%5B'broker_files'%5D.join('unique1'))%0A    expected = %5B%5B'key4', 'key11'%5D, %5B'a', 'b'%5D, %5B'c', 'd'%5D%5D%0A    assert read_f_file_rows('unique1', file_path) == expected%0A%0A    # re-order%0A    fileF_mock.mappings = OrderedDict(%0A        %5B('key11', 'mapping11'), ('key4', 'mapping4')%5D)%0A    file_path = str(mock_broker_config_paths%5B'broker_files'%5D.join('unique2'))%0A    expected = %5B%5B'key11', 'key4'%5D, %5B'b', 'a'%5D, %5B'd', 'c'%5D%5D%0A    assert read_f_file_rows('unique2', file_path) == expected%0A

Return generate_f_file tests