forked from retoor/devplacepy
fix: clear rate-limit hot-settings cache and add retry loop for maintenance-mode tests
- Invalidate `_hot_settings_value` and `_hot_settings_at` in `_patch_limits` so stale cached limits from prior tests do not persist after monkey-patching `get_int_setting`. - Add a polling retry loop (up to 5 seconds) in `test_maintenance_mode_blocks_guests` to handle eventual consistency of the maintenance-mode flag propagation. - Replace brittle hardcoded `@bob_test` assertion in mention test with dynamic `data-username` attribute extraction from the active dropdown item. - Replace `asyncio.run` calls in bot unit tests with shared `run_async` helper from `tests.conftest` to avoid event-loop conflicts in the test suite. - Change `insert` to `upsert` with `["uid"]` conflict target in Gitea test fixture to prevent duplicate-key errors on repeated test runs. - Replace `asyncio.new_event_loop().run_until_complete` in Telegram worker tests with the same shared `run_async` helper for consistency.
This commit is contained in:
@@ -772,7 +772,11 @@ def test_maintenance_mode_blocks_guests(alice):
|
||||
page, _ = alice
|
||||
try:
|
||||
_save_settings(page, maintenance_mode="1", maintenance_message="Down for tests")
|
||||
deadline = time.time() + 5.0
|
||||
response = requests.get(f"{BASE_URL}/feed")
|
||||
while response.status_code != 503 and time.time() < deadline:
|
||||
time.sleep(0.2)
|
||||
response = requests.get(f"{BASE_URL}/feed")
|
||||
assert response.status_code == 503
|
||||
assert "Down for tests" in response.text
|
||||
finally:
|
||||
|
||||
+4
-1
@@ -158,8 +158,11 @@ def test_mention_arrow_then_enter_inserts(alice):
|
||||
state="visible", timeout=5000
|
||||
)
|
||||
textarea.press("ArrowDown")
|
||||
selected = page.locator(".mention-dropdown-item.active").first
|
||||
selected.wait_for(state="visible", timeout=5000)
|
||||
username = selected.get_attribute("data-username")
|
||||
textarea.press("Enter")
|
||||
expect(textarea).to_have_value(re.compile(r"@bob_test\s"))
|
||||
expect(textarea).to_have_value(re.compile(rf"@{re.escape(username)}\s"))
|
||||
|
||||
|
||||
def test_mention_escape_closes_dropdown(alice):
|
||||
|
||||
Reference in New Issue
Block a user