mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 13:09:49 -04:00
Merge pull request #4131 from alphagov/job-finished-bug
fix bug where job reports showed before jobs finished
This commit is contained in:
@@ -107,7 +107,7 @@ class Job(JSONModel):
|
||||
@property
|
||||
def still_processing(self):
|
||||
return (
|
||||
self.percentage_complete < 100 and self.status != 'finished'
|
||||
self.status != 'finished' or self.percentage_complete < 100
|
||||
)
|
||||
|
||||
@cached_property
|
||||
|
||||
31
tests/app/models/test_job.py
Normal file
31
tests/app/models/test_job.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import pytest
|
||||
|
||||
from app.models.job import Job
|
||||
from tests import job_json, user_json
|
||||
from tests.conftest import SERVICE_ONE_ID
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'job_status, num_notifications_created, expected_still_processing',
|
||||
[
|
||||
('scheduled', 0, True),
|
||||
('cancelled', 10, True),
|
||||
('finished', 5, True),
|
||||
('finished', 10, False),
|
||||
]
|
||||
)
|
||||
def test_still_processing(
|
||||
notify_admin,
|
||||
job_status,
|
||||
num_notifications_created,
|
||||
expected_still_processing
|
||||
):
|
||||
json = job_json(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
created_by=user_json(),
|
||||
notification_count=10,
|
||||
notifications_requested=num_notifications_created,
|
||||
job_status=job_status
|
||||
)
|
||||
job = Job(json)
|
||||
assert job.still_processing == expected_still_processing
|
||||
Reference in New Issue
Block a user