Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Raphaël Cohen <[email protected]>
  • Loading branch information
a-leonardi and Darkheir authored Oct 7, 2024
1 parent 8d1485e commit bab1bbe
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions sekoia_automation/account_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AccountValidator(ModuleItem):
VALIDATION_CALLBACK_URL_FILE_NAME = "validation_callback_url"

@abstractmethod
def validator(self) -> bool:
def validate(self) -> bool:
"""To define in subclasses. Validates the configuration of the module.
Returns:
Expand All @@ -20,18 +20,8 @@ def execute(self):
"""Validates the account (module_configuration) of the module
and sends the result to Symphony."""
# Call the actual validation procedure
status = self.validator()
status = self.validate()

# Return result of validation to Symphony
data = {"validation_status": status}
validation_callback_url = self.module.load_config(
self.VALIDATION_CALLBACK_URL_FILE_NAME
)
response = requests.request(
"POST",
validation_callback_url,
json=data,
headers={"Authorization": f"Bearer {self.token}"},
timeout=30,
)
response.raise_for_status()
self._send_request(data)

0 comments on commit bab1bbe

Please sign in to comment.