test: issue closing after being on hold
This commit is contained in:
parent
267cc35850
commit
79f8159ab9
@ -142,6 +142,32 @@ class TestIssue(TestSetUp):
|
||||
issue.reload()
|
||||
self.assertEqual(flt(issue.total_hold_time, 2), 2700)
|
||||
|
||||
def test_issue_close_after_on_hold(self):
|
||||
creation = get_datetime("2021-11-01 19:00")
|
||||
|
||||
issue = make_issue(creation, index=1)
|
||||
create_communication(issue.name, "test@example.com", "Received", creation)
|
||||
|
||||
# send a reply within SLA
|
||||
creation = get_datetime("2021-11-02 11:00")
|
||||
create_communication(issue.name, "test@admin.com", "Sent", creation)
|
||||
|
||||
frappe.flags.current_time = creation
|
||||
issue.reload()
|
||||
issue.status = 'Replied'
|
||||
issue.save()
|
||||
|
||||
self.assertEqual(issue.on_hold_since, frappe.flags.current_time)
|
||||
|
||||
# close the issue after being on hold for 20 days
|
||||
frappe.flags.current_time = get_datetime("2021-11-22 01:00")
|
||||
issue.status = 'Closed'
|
||||
issue.save()
|
||||
|
||||
self.assertEqual(issue.resolution_by, get_datetime('2021-11-22 06:00:00'))
|
||||
self.assertEqual(issue.resolution_date, get_datetime('2021-11-22 01:00:00'))
|
||||
self.assertEqual(issue.agreement_status, 'Fulfilled')
|
||||
|
||||
class TestFirstResponseTime(TestSetUp):
|
||||
# working hours used in all cases: Mon-Fri, 10am to 6pm
|
||||
# all dates are in the mm-dd-yyyy format
|
||||
|
@ -642,7 +642,7 @@ def reset_expected_response_and_resolution(doc):
|
||||
def set_response_by_and_variance(doc, start_date_time, priority):
|
||||
if doc.meta.has_field("response_by"):
|
||||
doc.response_by = get_expected_time_for(parameter="response", service_level=priority, start_date_time=start_date_time)
|
||||
if doc.meta.has_field("total_hold_time") and doc.get('total_hold_time'):
|
||||
if doc.meta.has_field("total_hold_time") and doc.get('total_hold_time') and not doc.get('first_responded_on'):
|
||||
doc.response_by = add_to_date(doc.response_by, seconds=round(doc.get('total_hold_time')))
|
||||
|
||||
if doc.meta.has_field("response_by_variance") and not doc.get('first_responded_on'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user