c610126cc645933cc24fd4f6548ed953caa6d857,app/tests/cases_tests/test_background_tasks.py,,test_mhd_file_creation,#,50
Before Change
]
session, uploaded_images = create_raw_upload_image_session(images)
session.session_state = UPLOAD_SESSION_STATE.queued
session.save()
build_images(session.pk)
session.refresh_from_db()
assert session.session_state == UPLOAD_SESSION_STATE.stopped
assert session.error_message is None
assert Image.objects.filter(origin=session).count() == 3
After Change
@pytest.mark.django_db
def test_mhd_file_creation():
task_collector = CeleryTaskCollector(signals.build_images)
with replace_var(signals, "build_images", task_collector):
images = [
"image10x10x10.zraw",
"image10x10x10.mhd",
"image10x10x10.mha",
"image10x10x10-extra-stuff.mhd",
"invalid_utf8.mhd",
"no_image",
]
session, uploaded_images = create_raw_upload_image_session(images)
task_collector.execute_calls()
session.refresh_from_db()
assert session.session_state == UPLOAD_SESSION_STATE.stopped
assert session.error_message is None
assert Image.objects.filter(origin=session).count() == 3
for name, db_object in uploaded_images.items():
name: str
db_object: RawImageFile
db_object.refresh_from_db()
assert db_object.staged_file_id is None
if name in ("no_image", "invalid_utf8.mhd"):
assert db_object.error is not None
else:
assert db_object.error is None
@pytest.mark.django_db
def test_staged_uploaded_file_cleanup_interferes_with_image_build():
task_collector = CeleryTaskCollector(signals.build_images)
with replace_var(signals, "build_images", task_collector):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 15
Instances
Project Name: comic/grand-challenge.org
Commit Name: c610126cc645933cc24fd4f6548ed953caa6d857
Time: 2018-06-27
Author: pkcakeout@gmail.com
File Name: app/tests/cases_tests/test_background_tasks.py
Class Name:
Method Name: test_mhd_file_creation
Project Name: comic/grand-challenge.org
Commit Name: c610126cc645933cc24fd4f6548ed953caa6d857
Time: 2018-06-27
Author: pkcakeout@gmail.com
File Name: app/tests/cases_tests/test_background_tasks.py
Class Name:
Method Name: test_errors_on_files_with_duplicate_file_names
Project Name: comic/grand-challenge.org
Commit Name: c610126cc645933cc24fd4f6548ed953caa6d857
Time: 2018-06-27
Author: pkcakeout@gmail.com
File Name: app/tests/cases_tests/test_background_tasks.py
Class Name:
Method Name: test_mhd_file_creation
Project Name: comic/grand-challenge.org
Commit Name: c610126cc645933cc24fd4f6548ed953caa6d857
Time: 2018-06-27
Author: pkcakeout@gmail.com
File Name: app/tests/cases_tests/test_background_tasks.py
Class Name:
Method Name: test_staged_uploaded_file_cleanup_interferes_with_image_build