Skip to content

Commit

Permalink
Update unit test mock
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d committed Jun 20, 2024
1 parent 2cb0e8f commit 4b1dc81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion convert2rhel/actions/system_checks/els.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
import logging

from convert2rhel import actions
from convert2rhel.systeminfo import ELS_START_DATE, system_info
from convert2rhel.systeminfo import system_info
from convert2rhel.toolopts import tool_opts


logger = logging.getLogger(__name__)

ELS_START_DATE = "2024-07-01"


class ElsSystemCheck(actions.Action):
id = "ELS_SYSTEM_CHECK"
Expand All @@ -38,6 +40,7 @@ def run(self):
# Turn ELS_START_DATE into a datetime object
els_start_date = datetime.datetime.strptime(ELS_START_DATE, "%Y-%m-%d").date()

print(current_datetime > els_start_date)
# warning message if the els release date is past and the --els option is not set
if not tool_opts.els and current_datetime > els_start_date:
self.add_message(
Expand Down
2 changes: 0 additions & 2 deletions convert2rhel/systeminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
# Dictionary of EUS minor versions supported and their EUS period start date
EUS_MINOR_VERSIONS = {"8.8": "2023-11-14"}

ELS_START_DATE = "2024-07-01"

Version = namedtuple("Version", ["major", "minor"])


Expand Down
9 changes: 6 additions & 3 deletions convert2rhel/unit_tests/actions/system_checks/els_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def els_action():
class DateMock(datetime.date):
@classmethod
def today(cls):
return cls(2024, 6, 13)
return cls(2024, 7, 2)


class TestEus:
Expand All @@ -58,8 +58,11 @@ def test_els_warning_message(self, els_action, monkeypatch, global_tool_opts, ve
level="WARNING",
id="ELS_COMMAND_LINE_OPTION_UNUSED",
title="The --els command line option is unused",
description="Current system version is under Extended Lifecycle Support (ELS). You may want to consider using the --els"
" command line option to land on a system patched with the latest security errata.",
description=(
"Current system version is under Extended Lifecycle Support (ELS). You may want to "
"consider using the --els command line option to land on a system patched with the latest "
"security errata.",
),
),
)
)
Expand Down

0 comments on commit 4b1dc81

Please sign in to comment.