refactor(config): migrer les endpoints Pronote
Co-authored-by: Codex <codex@antoineve.me>
This commit is contained in:
+17
-15
@@ -251,7 +251,7 @@ def test_fetch_agenda_auto_both_fail(mock_fetcher: PronoteFetcher) -> None:
|
||||
:rtype: None
|
||||
"""
|
||||
# Disable pronotepy so fallback is None
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
|
||||
with (
|
||||
patch("pronote_sync.sources.pronote.fallback.fetch_ical") as m_fetch_ical,
|
||||
@@ -280,7 +280,7 @@ def test_fetch_agenda_ical_mode_failure(mock_fetcher: PronoteFetcher) -> None:
|
||||
"""
|
||||
# Override settings to use ical mode explicitly and disable fallback
|
||||
mock_fetcher._settings.pronote.agenda_source = "ical"
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
|
||||
with (
|
||||
patch("pronote_sync.sources.pronote.fallback.fetch_ical") as m_fetch_ical,
|
||||
@@ -311,7 +311,7 @@ def test_fetch_agenda_pronotepy_mode_failure(mock_fetcher: PronoteFetcher) -> No
|
||||
"""
|
||||
# Override settings to use pronotepy mode explicitly and disable fallback
|
||||
mock_fetcher._settings.pronote.agenda_source = "pronotepy"
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
|
||||
client = MagicMock()
|
||||
client.get_lessons.side_effect = OSError("Pronote API error")
|
||||
@@ -438,7 +438,7 @@ def test_fetch_homework_auto_both_fail(mock_fetcher: PronoteFetcher) -> None:
|
||||
target_date = date(2025, 9, 10)
|
||||
|
||||
# Disable pronotepy so fallback is None
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
|
||||
with (
|
||||
patch("pronote_sync.sources.pronote.fallback.fetch_ical") as m_fetch_ical,
|
||||
@@ -531,7 +531,7 @@ def test_no_secrets_in_error_messages(
|
||||
:rtype: None
|
||||
"""
|
||||
# Disable pronotepy so fallback is None to trigger PipelineCriticalError
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
|
||||
with (
|
||||
patch("pronote_sync.sources.pronote.fallback.fetch_ical") as m_fetch_ical,
|
||||
@@ -628,8 +628,8 @@ def test_fetch_agenda_no_source_configured_raises(mock_fetcher: PronoteFetcher)
|
||||
:rtype: None
|
||||
"""
|
||||
# Disable both sources
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
|
||||
with pytest.raises(PipelineCriticalError) as exc_info:
|
||||
mock_fetcher.fetch_agenda()
|
||||
@@ -912,8 +912,10 @@ def test_fetch_agenda_ical_url_none_raises_value_error(mock_fetcher: PronoteFetc
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
with pytest.raises(ValueError, match="PRONOTE_ICAL_URL est requis pour la source iCal"):
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
with pytest.raises(
|
||||
ValueError, match="PRONOTE_ICAL_ENDPOINT__URL est requis pour la source iCal"
|
||||
):
|
||||
mock_fetcher._fetch_agenda_ical()
|
||||
|
||||
|
||||
@@ -928,7 +930,7 @@ def test_agenda_sources_auto_only_pronotepy_configured(mock_fetcher: PronoteFetc
|
||||
:rtype: None
|
||||
"""
|
||||
mock_fetcher._settings.pronote.agenda_source = "auto"
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
primary, fallback = mock_fetcher._agenda_sources()
|
||||
assert primary == "pronotepy"
|
||||
assert fallback is None
|
||||
@@ -1020,7 +1022,7 @@ def test_homework_sources_explicit_ical_mode_strict(mock_fetcher: PronoteFetcher
|
||||
assert fallback is None
|
||||
|
||||
# Without pronotepy configured
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
primary, fallback = mock_fetcher._homework_sources()
|
||||
assert primary == "ical"
|
||||
assert fallback is None
|
||||
@@ -1046,7 +1048,7 @@ def test_homework_sources_explicit_pronotepy_mode_strict(
|
||||
assert fallback is None
|
||||
|
||||
# Without ical configured
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
primary, fallback = mock_fetcher._homework_sources()
|
||||
assert primary == "pronotepy"
|
||||
assert fallback is None
|
||||
@@ -1063,7 +1065,7 @@ def test_homework_sources_auto_only_pronotepy_configured(mock_fetcher: PronoteFe
|
||||
:rtype: None
|
||||
"""
|
||||
mock_fetcher._settings.pronote.homework_source = "auto"
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
primary, fallback = mock_fetcher._homework_sources()
|
||||
assert primary == "pronotepy"
|
||||
assert fallback is None
|
||||
@@ -1079,8 +1081,8 @@ def test_homework_sources_auto_no_source_configured_raises(mock_fetcher: Pronote
|
||||
:rtype: None
|
||||
"""
|
||||
mock_fetcher._settings.pronote.homework_source = "auto"
|
||||
mock_fetcher._settings.pronote.ical_url = None
|
||||
mock_fetcher._settings.pronote.url = None
|
||||
mock_fetcher._settings.pronote.ical_endpoint = None
|
||||
mock_fetcher._settings.pronote.endpoint = None
|
||||
|
||||
with pytest.raises(PipelineCriticalError) as exc_info:
|
||||
mock_fetcher._homework_sources()
|
||||
|
||||
Reference in New Issue
Block a user