From 51e3a85795abb7d0ae403495e948dc994638ff7b Mon Sep 17 00:00:00 2001 From: Gree44 Date: Fri, 24 Jul 2026 23:38:53 +0200 Subject: [PATCH] Feat #179: 36 Monate (3 Jahre) Laufzeit erlauben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Erlaubt Deployments mit einer Laufzeit von bis zu 36 Monaten (3 Jahre, Dauer des Studiums) — sowohl beim Erstellen als auch beim Verlaengern. - ALLOWED_RUNTIME_MONTHS um 36 erweitert (src/schemas/deployment.py). Der field_validator auf DeploymentCreate/DeploymentExtend akzeptiert damit 36 statt es mit 422 abzulehnen. - deployment_expiry.py: Monats-Arithmetik ist generisch, keine Aenderung noetig; nur den Kommentar-Bereich 1..24 -> 1..36 nachgezogen. - Tests: allowed-set-Assertion und parametrize-Listen um 36 ergaenzt, 36 aus der "rejected"-Liste entfernt (test_deployment_runtime_validation.py, test_deployment_expiry_helpers.py). Frontend-Gegenstueck folgt als separater PR in appstore-frontend. --- src/schemas/deployment.py | 2 +- src/utils/deployment_expiry.py | 2 +- tests/unit/test_deployment_expiry_helpers.py | 2 +- tests/unit/test_deployment_runtime_validation.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/schemas/deployment.py b/src/schemas/deployment.py index 6465aa1..c1bb969 100644 --- a/src/schemas/deployment.py +++ b/src/schemas/deployment.py @@ -6,7 +6,7 @@ # Allowed lifetime presets matching the Wizard dropdown. # Keep this in sync with appstore-frontend/src/pages/DeploymentWizard.tsx. -ALLOWED_RUNTIME_MONTHS = (1, 3, 4, 6, 12, 24) +ALLOWED_RUNTIME_MONTHS = (1, 3, 4, 6, 12, 24, 36) DEFAULT_RUNTIME_MONTHS = 4 diff --git a/src/utils/deployment_expiry.py b/src/utils/deployment_expiry.py index 01b8fe6..aa96054 100644 --- a/src/utils/deployment_expiry.py +++ b/src/utils/deployment_expiry.py @@ -19,7 +19,7 @@ WARNING_FRACTION_OF_RUNTIME = 0.25 # Average month length used to derive timedelta from ``runtime_months``. Calendar -# months vary; over 1..24 months this ~30.44-day approximation drifts at most a +# months vary; over 1..36 months this ~30.44-day approximation drifts at most a # day or two from the calendar date — acceptable for an expiry deadline. DAYS_PER_MONTH = 30 diff --git a/tests/unit/test_deployment_expiry_helpers.py b/tests/unit/test_deployment_expiry_helpers.py index fda78e0..52daa69 100644 --- a/tests/unit/test_deployment_expiry_helpers.py +++ b/tests/unit/test_deployment_expiry_helpers.py @@ -20,7 +20,7 @@ def _now() -> datetime: return datetime(2026, 6, 20, 12, 0, 0, tzinfo=timezone.utc) -@pytest.mark.parametrize("months", [1, 3, 4, 6, 12, 24]) +@pytest.mark.parametrize("months", [1, 3, 4, 6, 12, 24, 36]) def test_compute_expiry_returns_two_future_timestamps(months: int): """expires_at and expiry_warning_at must both be in the future.""" now = _now() diff --git a/tests/unit/test_deployment_runtime_validation.py b/tests/unit/test_deployment_runtime_validation.py index 9c66443..c2e5ec6 100644 --- a/tests/unit/test_deployment_runtime_validation.py +++ b/tests/unit/test_deployment_runtime_validation.py @@ -16,17 +16,17 @@ def test_default_runtime_months_is_4(): def test_allowed_set_matches_wizard_dropdown(): """Backend's allowed set must match the Wizard