Skip to content

Commit

Permalink
Bug 1081600 - add a test to confirm the behaviour of job type/job gro…
Browse files Browse the repository at this point in the history
…up associations
  • Loading branch information
maurodoglio committed Oct 16, 2014
1 parent 6fab3a0 commit 70c8548
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/model/derived/test_jobs_model.py
Expand Up @@ -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

0 comments on commit 70c8548

Please sign in to comment.