test(meters): isolate intervention idempotence fixture
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
89a738bbde
commit
14b80401a9
1 changed files with 9 additions and 0 deletions
|
|
@ -215,6 +215,15 @@ def test_c3_alert_close_route_and_dashboard_summaries(app, admin_user, authentic
|
|||
assert response.status_code == 302
|
||||
with app.app_context():
|
||||
assert db.session.get(MeterAlert, alert_id).status == "CLOSED"
|
||||
from app_new.core.models.maintenance import Intervention
|
||||
before = Intervention.query.count()
|
||||
first = authenticated_client.post(f"/planning/meter-alerts/{alert_id}/create-intervention", data={})
|
||||
second = authenticated_client.post(f"/planning/meter-alerts/{alert_id}/create-intervention", data={})
|
||||
after = Intervention.query.count()
|
||||
assert first.status_code == 302 and second.status_code == 302 and after == before + 1
|
||||
created = db.session.get(MeterAlert, alert_id).intervention
|
||||
db.session.delete(created)
|
||||
db.session.commit()
|
||||
dashboard = authenticated_client.get("/planning/meter-monitoring")
|
||||
assert dashboard.status_code == 200
|
||||
assert b"Eau" in dashboard.data and b"m" in dashboard.data
|
||||
|
|
|
|||
Loading…
Reference in a new issue