Skip to content

Commit 52a7b5f

Browse files
committed
Ensure photo is change on overwrite review
1 parent 7e6a477 commit 52a7b5f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

api/tests/test_views.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,17 +1068,22 @@ def test_agree_review_create_expertreportannotation(self, api_client, endpoint,
10681068
assert identification_task.reviewed_at == timezone.now()
10691069

10701070
@time_machine.travel("2024-01-01 00:00:00", tick=False)
1071-
def test_overwrite_review_create_expertreportannotation(self, api_client, endpoint, user_with_role_reviewer, identification_task, taxon_root):
1071+
def test_overwrite_review_create_expertreportannotation(self, api_client, endpoint, user_with_role_reviewer, identification_task, taxon_root, dummy_image):
10721072
assert ExpertReportAnnotation.objects.filter(
10731073
identification_task=identification_task,
10741074
user=user_with_role_reviewer
10751075
).count() == 0
10761076

1077+
another_photo = Photo.objects.create(
1078+
photo=dummy_image,
1079+
report=identification_task.report,
1080+
)
1081+
10771082
response = api_client.post(
10781083
endpoint,
10791084
data={
10801085
'action': 'overwrite',
1081-
'public_photo_uuid': identification_task.photo.uuid,
1086+
'public_photo_uuid': another_photo.uuid,
10821087
'is_safe': True,
10831088
'public_note': 'new test public note',
10841089
'result': {
@@ -1097,7 +1102,7 @@ def test_overwrite_review_create_expertreportannotation(self, api_client, endpoi
10971102
assert not annotation.validation_complete_executive
10981103
assert annotation.status == ExpertReportAnnotation.STATUS_PUBLIC
10991104
assert annotation.validation_complete
1100-
assert annotation.best_photo.uuid == identification_task.photo.uuid
1105+
assert annotation.best_photo.uuid == another_photo.uuid
11011106
assert not annotation.simplified_annotation
11021107
assert annotation.revise
11031108

@@ -1108,6 +1113,7 @@ def test_overwrite_review_create_expertreportannotation(self, api_client, endpoi
11081113
assert identification_task.public_note == 'new test public note'
11091114
assert identification_task.taxon == taxon_root
11101115
assert identification_task.confidence == 1
1116+
assert identification_task.photo == another_photo
11111117

11121118
@pytest.mark.django_db
11131119
class TestPermissionsApi:

0 commit comments

Comments
 (0)