From 70c85484cd317dd6cbb8ef4f1bf7cdfdf9d11654 Mon Sep 17 00:00:00 2001 From: mdoglio Date: Thu, 16 Oct 2014 12:16:15 +0100 Subject: [PATCH] Bug 1081600 - add a test to confirm the behaviour of job type/job group associations --- tests/model/derived/test_jobs_model.py | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/model/derived/test_jobs_model.py b/tests/model/derived/test_jobs_model.py index 55016336f..391f60609 100644 --- a/tests/model/derived/test_jobs_model.py +++ b/tests/model/derived/test_jobs_model.py @@ -482,3 +482,37 @@ def test_bug_job_map_detail(jm, eleven_jobs_processed): assert actual == expected + +def test_ingest_job_with_updated_job_group(jm, refdata, sample_data, initial_data, + mock_log_parser, result_set_stored): + """ + When a job_type is associated with a job group on data ingestion, + that association will not updated ingesting a new job with the same + job_type but different job_group + """ + first_job = sample_data.job_data[0] + first_job["job"]["group_name"] = "first group name" + first_job["job"]["group_symbol"] = "1" + first_job["revision_hash"] = result_set_stored[0]["revision_hash"] + jm.load_job_data([first_job]) + jm.process_objects(1) + + second_job = copy.deepcopy(first_job) + # create a new guid to ingest the job again + second_job_guid = "a-unique-job-guid" + second_job["job"]["job_guid"] = second_job_guid + second_job["job"]["group_name"] = "second group name" + second_job["job"]["group_symbol"] = "2" + second_job["revision_hash"] = result_set_stored[0]["revision_hash"] + + jm.load_job_data([second_job]) + jm.process_objects(1) + + second_job_lookup = jm.get_job_ids_by_guid([second_job_guid]) + second_job_stored = jm.get_job(second_job_lookup[second_job_guid]["id"]) + + first_job_group_name = first_job["job"]["group_name"] + + second_job_group_name = second_job_stored[0]["job_group_name"] + + assert first_job_group_name == second_job_group_name