Skip to content

Commit

Permalink
Removing deprecated smtp config check from loans_migrator task after …
Browse files Browse the repository at this point in the history
…removing support for pre-ramsons releases of FOLIO. Updating tests to use a supported FolioRelease value.
  • Loading branch information
bltravis committed Feb 11, 2025
1 parent a061d42 commit 46a72bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 32 deletions.
37 changes: 8 additions & 29 deletions src/folio_migration_tools/migration_tasks/loans_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from datetime import datetime, timedelta
from typing import Optional
from urllib.error import HTTPError
from zoneinfo import ZoneInfo

import i18n
from dateutil import parser as du_parser
from folio_uuid.folio_namespaces import FOLIONamespaces
from zoneinfo import ZoneInfo

from folio_migration_tools.circulation_helper import CirculationHelper
from folio_migration_tools.helper import Helper
Expand Down Expand Up @@ -131,34 +131,13 @@ def __init__(
logging.info("Init completed")

def check_smtp_config(self):
if self.library_configuration.folio_release.lower() == FolioRelease.morning_glory:
logging.warn("DEPRECATED: Morning Glory support will be removed in a future release!")
okapi_config_base_path = "/configurations/entries"
okapi_config_query = "(module=={}%20and%20configName=={}%20and%20code=={})"
okapi_config_limit = 1000
okapi_config_module = "SMTP_SERVER"
okapi_config_name = "smtp"
okapi_config_code = "EMAIL_SMTP_HOST_DISABLED"
smtp_config_path = (
okapi_config_base_path
+ "?"
+ str(okapi_config_limit)
+ "&query="
+ okapi_config_query.format(
okapi_config_module, okapi_config_name, okapi_config_code
)
)
smtp_config_disabled = self.folio_client.folio_get_single_object(smtp_config_path)[
"configs"
]
else:
try:
smtp_config = self.folio_client.folio_get_single_object("/smtp-configuration")[
"smtpConfigurations"
][0]
smtp_config_disabled = "disabled" in smtp_config["host"].lower()
except IndexError:
smtp_config_disabled = True
try:
smtp_config = self.folio_client.folio_get_single_object("/smtp-configuration")[
"smtpConfigurations"
][0]
smtp_config_disabled = "disabled" in smtp_config["host"].lower()
except IndexError:
smtp_config_disabled = True
print_smtp_warning()
if not smtp_config_disabled:
logging.warn("SMTP connection not disabled...")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/main/basic_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"okapiUsername": "",
"libraryName": "",
"logLevelDebug": false,
"folioRelease": "poppy",
"folioRelease": "ramsons",
"iterationIdentifier": "",
"tenantId": ""
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/main/json_not_matching_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"okapiUsername": "",
"libraryName": "",
"logLevelDebug": false,
"folioRelease": "poppy",
"folioRelease": "ramsons",
"iterationIdentifier": ""
},
"octopus": "squid"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rules_mapper_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def mapper_base(folio_client):
"ils_flavour": "field001"
}
mapper = RulesMapperBase(folio_client, mapper_library_configuration, mapper_task_configuration, {})
mapper.conditions = Conditions(folio_client, mapper, "any", FolioRelease.quesnelia, "Library of Congress classification")
mapper.conditions = Conditions(folio_client, mapper, "any", FolioRelease.ramsons, "Library of Congress classification")
return mapper


Expand Down

0 comments on commit 46a72bf

Please sign in to comment.