|
15 | 15 | GET_XML_CLOUD_NO_FREQ_DETAILS = TEST_ASSET_DIR / "subscription_get_cloud_no_frequency_details.xml" |
16 | 16 | GET_XML_CLOUD_EMPTY_INTERVALS = TEST_ASSET_DIR / "subscription_get_cloud_empty_intervals.xml" |
17 | 17 | GET_XML_CLOUD_BAD_HOURS = TEST_ASSET_DIR / "subscription_get_cloud_bad_hours.xml" |
| 18 | +GET_XML_CLOUD_NO_START = TEST_ASSET_DIR / "subscription_get_cloud_no_start.xml" |
| 19 | +GET_XML_CLOUD_HOURLY = TEST_ASSET_DIR / "subscription_get_cloud_hourly.xml" |
18 | 20 |
|
19 | 21 |
|
20 | 22 | @pytest.fixture(scope="function") |
@@ -246,3 +248,29 @@ def test_get_subscriptions_cloud_empty_intervals(server: TSC.Server) -> None: |
246 | 248 | assert "Daily" == subscription.schedule.frequency |
247 | 249 | assert subscription.schedule.interval_item is not None |
248 | 250 | assert () == tuple(subscription.schedule.interval_item.interval) |
| 251 | + |
| 252 | + |
| 253 | +def test_get_subscriptions_cloud_frequency_details_without_start(server: TSC.Server) -> None: |
| 254 | + """``<frequencyDetails>`` with ``intervals`` but no ``start`` must not abort the page.""" |
| 255 | + with requests_mock.mock() as m: |
| 256 | + m.get(server.subscriptions.baseurl, text=GET_XML_CLOUD_NO_START.read_text()) |
| 257 | + all_subscriptions, _ = server.subscriptions.get() |
| 258 | + |
| 259 | + assert 1 == len(all_subscriptions) |
| 260 | + schedule = all_subscriptions[0].schedule |
| 261 | + assert schedule is not None |
| 262 | + assert "Daily" == schedule.frequency |
| 263 | + # DailyInterval requires a start time; the missing one degrades to None. |
| 264 | + assert schedule.interval_item is None |
| 265 | + |
| 266 | + |
| 267 | +def test_get_subscriptions_cloud_hourly_hours_are_numeric(server: TSC.Server) -> None: |
| 268 | + """Hourly ``hours="3"`` is invalid and must degrade to None; ``hours="2"`` parses.""" |
| 269 | + with requests_mock.mock() as m: |
| 270 | + m.get(server.subscriptions.baseurl, text=GET_XML_CLOUD_HOURLY.read_text()) |
| 271 | + all_subscriptions, _ = server.subscriptions.get() |
| 272 | + |
| 273 | + invalid, valid = all_subscriptions |
| 274 | + assert invalid.schedule.interval_item is None |
| 275 | + assert valid.schedule.interval_item is not None |
| 276 | + assert 2 in valid.schedule.interval_item.interval |
0 commit comments