Skip to content

Commit

Permalink
OM-180 Fixed flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
malinowskikam committed Jun 4, 2024
1 parent 08f9ae4 commit 7d5ff24
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions msystems/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ class MsystemsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "msystems"

##### DO NOT CHANGE THIS ####
# DO NOT CHANGE THIS ####
ADMIN = "Admin"
INSPECTOR = "Inspector"
EMPLOYER = "Employer"
IMIS_ADMIN = "IMIS Administrator"
ENROLMENT_OFFICER = "Enrolment Officer"
##### ------------------ ####
# ------------------ ####

default_mpass_language = None

Expand Down
2 changes: 1 addition & 1 deletion msystems/tests/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
'Test Organisation 2 1234123412341'
],
'Role': ['Employer']
}
}
4 changes: 2 additions & 2 deletions msystems/views/mpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def _validate_envelope(ctx):
try:
verify_timestamp(root)
except ValueError as e:
logger.error(f"Timestamp verification failed", exc_info=e)
logger.error("Timestamp verification failed", exc_info=e)
raise Fault(faultcode='InvalidRequest', faultstring=str(e))

try:
verify_signature(root, MsystemsConfig.mpay_config['mpay_certificate'])
except SignatureVerificationFailed as e:
logger.error("Envelope signature verification failed", exc_info=e)
raise Fault(faultcode='InvalidRequest', faultstring=f'Envelope signature verification failed')
raise Fault(faultcode='InvalidRequest', faultstring='Envelope signature verification failed')


def _add_envelope_header(ctx):
Expand Down
1 change: 1 addition & 0 deletions msystems/xml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def replace_utc_timezone_with_offset(dt_str):
# Python 3.9 does not support Z timezone in datetime strings
return re.sub(r'Z$', '+00:00', dt_str)


def verify_timestamp(root):
dt_now = datetime.datetime.from_ad_datetime(py_datetime.datetime.now(tz=py_datetime.timezone.utc))
created, expires = root.find(created_xpath), root.find(expires_xpath)
Expand Down

0 comments on commit 7d5ff24

Please sign in to comment.