Skip to content

Commit 56e5372

Browse files
committed
lint
1 parent f5a7b38 commit 56e5372

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

auth-api/src/auth_api/resources/v1/task.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ def put_task(task_id):
8989
task = TaskService(TaskModel.find_by_task_id(task_id))
9090
if task:
9191
# Update task and its relationships
92-
origin = request.environ.get("HTTP_ORIGIN", "localhost")
93-
task_dict = task.update_task(task_info=request_json, origin_url=origin).as_dict()
92+
task_dict = task.update_task(task_info=request_json).as_dict()
9493
# ProductService uses TaskService already. So, we need to avoid circular import.
9594
if task_dict["relationship_type"] == TaskRelationshipType.PRODUCT.value:
9695
ProductService.update_org_product_keycloak_groups(task_dict["account_id"])

auth-api/src/auth_api/services/org.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ def _create_staff_review_task(org: OrgModel, user: UserModel):
206206
def _send_account_created_notification(org: OrgModel, user: UserModel):
207207
"""Send account created notification to the user."""
208208
current_app.logger.debug("<_send_account_created_notification")
209-
app_url = current_app.config.get('WEB_APP_URL')
209+
app_url = current_app.config.get("WEB_APP_URL")
210210
recipients = UserService.get_admin_emails_for_org(org.id)
211-
login_source = user.login_source
211+
login_source = user.login_source if user else None
212212
if not recipients:
213213
current_app.logger.warning(f"No recipient found for org {org.id}")
214214
return
@@ -980,7 +980,7 @@ def change_org_status(self, status_code, suspension_reason_code):
980980
return Org(org_model)
981981

982982
@staticmethod
983-
def approve_or_reject(org_id: int, is_approved: bool, origin_url: str = None, task_action: str = None):
983+
def approve_or_reject(org_id: int, is_approved: bool, task_action: str = None):
984984
"""Mark the affidavit as approved or rejected."""
985985
current_app.logger.debug("<find_affidavit_by_org_id ")
986986
# Get the org and check what's the current status
@@ -1061,7 +1061,7 @@ def send_approved_rejected_notification(receipt_admin_emails, org_name, org_id,
10611061
notification_type = QueueMessageTypes.NON_BCSC_ORG_REJECTED_NOTIFICATION.value
10621062
else:
10631063
return # Don't send mail for any other status change
1064-
app_url = current_app.config.get('WEB_APP_URL')
1064+
app_url = current_app.config.get("WEB_APP_URL")
10651065
data = {
10661066
"accountId": org_id,
10671067
"emailAddresses": receipt_admin_emails,

auth-api/src/auth_api/services/task.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def close_task(task_id, remarks: [] = None, do_commit: bool = True):
9090
if do_commit:
9191
db.session.commit()
9292

93-
def update_task(self, task_info: dict = None, origin_url: str = None):
93+
def update_task(self, task_info: dict = None):
9494
"""Update a task record."""
9595
current_app.logger.debug("<update_task ")
9696
task_model: TaskModel = self._model
@@ -104,12 +104,12 @@ def update_task(self, task_info: dict = None, origin_url: str = None):
104104
task_model.relationship_status = task_relationship_status
105105
task_model.flush()
106106

107-
self._update_relationship(origin_url=origin_url)
107+
self._update_relationship()
108108
db.session.commit()
109109
current_app.logger.debug(">update_task ")
110110
return Task(task_model)
111111

112-
def _update_relationship(self, origin_url: str = None):
112+
def _update_relationship(self):
113113
"""Retrieve the relationship record and update the status."""
114114
task_model: TaskModel = self._model
115115
current_app.logger.debug("<update_task_relationship ")
@@ -121,7 +121,7 @@ def _update_relationship(self, origin_url: str = None):
121121
org_id = task_model.relationship_id
122122
if not is_hold:
123123
self._update_org(
124-
is_approved=is_approved, org_id=org_id, origin_url=origin_url, task_action=task_model.action
124+
is_approved=is_approved, org_id=org_id, task_action=task_model.action, user=user
125125
)
126126
else:
127127
# Task with ACCOUNT_REVIEW action cannot be put on hold
@@ -211,7 +211,7 @@ def _notify_admin_about_hold(
211211
"applicationDate": f"{task_model.created.strftime('%m/%d/%Y')}",
212212
"accountId": account_id,
213213
"emailAddresses": admin_emails,
214-
"contextUrl": f"{current_app.config.get('WEB_APP_URL')}"
214+
"contextUrl": f"{current_app.config.get("WEB_APP_URL")}"
215215
f"/{current_app.config.get('BCEID_SIGNIN_ROUTE')}/"
216216
f"{create_account_signin_route}",
217217
}
@@ -223,14 +223,14 @@ def _notify_admin_about_hold(
223223
raise BusinessException(Error.FAILED_NOTIFICATION, None) from e
224224

225225
@staticmethod
226-
def _update_org(is_approved: bool, org_id: int, origin_url: str = None, task_action: str = None):
226+
def _update_org(is_approved: bool, org_id: int, task_action: str = None):
227227
"""Approve/Reject Affidavit and Org."""
228228
from auth_api.services import Org as OrgService # pylint:disable=cyclic-import, import-outside-toplevel
229229

230230
current_app.logger.debug("<update_task_org ")
231231

232232
OrgService.approve_or_reject(
233-
org_id=org_id, is_approved=is_approved, origin_url=origin_url, task_action=task_action
233+
org_id=org_id, is_approved=is_approved, task_action=task_action
234234
)
235235

236236
current_app.logger.debug(">update_task_org ")

auth-api/tests/unit/api/test_org.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
patch_pay_account_delete_error,
8484
patch_pay_account_fees,
8585
patch_pay_account_post,
86-
patch_pay_account_post,
8786
patch_pay_account_put,
8887
)
8988

0 commit comments

Comments
 (0)