mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
more test fixes
This commit is contained in:
@@ -138,23 +138,6 @@ class Job(JSONModel):
|
||||
def percentage_complete(self):
|
||||
return self.notifications_requested / self.notification_count * 100
|
||||
|
||||
@property
|
||||
def letter_job_can_be_cancelled(self):
|
||||
|
||||
if self.template['template_type'] != 'letter':
|
||||
return False
|
||||
|
||||
if any(self.uncancellable_notifications):
|
||||
return False
|
||||
|
||||
if not letter_can_be_cancelled(
|
||||
'created',
|
||||
convert_utc_to_local_timezone(self.created_at).replace(tzinfo=None)
|
||||
):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@cached_property
|
||||
def all_notifications(self):
|
||||
return self.get_notifications(set_status_filters({}))['notifications']
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import dateutil
|
||||
from datetime import datetime
|
||||
|
||||
from flask import abort, request, session
|
||||
@@ -126,8 +127,10 @@ class User(JSONModel, UserMixin):
|
||||
def password_changed_more_recently_than(self, datetime_string):
|
||||
if not self.password_changed_at:
|
||||
return False
|
||||
datetime_string = dateutil.parser.parse(datetime_string, ignoretz=True)
|
||||
changed = dateutil.parser.parse(self.password_changed_at, ignoretz=True)
|
||||
return convert_utc_to_local_timezone(
|
||||
self.password_changed_at
|
||||
changed
|
||||
) > convert_utc_to_local_timezone(
|
||||
datetime_string
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user