This commit is contained in:
@@ -8,7 +8,8 @@ The `seeded_client` fixture pre-populates:
|
||||
BrandX 002 (id=3, retired)
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import io
|
||||
import json as _json
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
@@ -169,7 +170,7 @@ def test_edit_details_percentage_valid(seeded_client):
|
||||
data = _json.loads(seeded_client.get("/export/all.json").data)
|
||||
bat = next(b for b in data["batteries"] if b["id"] == 1)
|
||||
assert bat["battery_percentage"] == 100
|
||||
assert any(l["battery_id"] == 1 and l["source"] == "manual" for l in data["pct_logs"])
|
||||
assert any(entry["battery_id"] == 1 and entry["source"] == "manual" for entry in data["pct_logs"])
|
||||
|
||||
|
||||
def test_assign_battery(seeded_client):
|
||||
@@ -699,9 +700,6 @@ def test_bulk_install_filters_by_size(client):
|
||||
# Import
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
import io
|
||||
import json as _json
|
||||
|
||||
|
||||
def _make_import_payload(devices=None, batteries=None,
|
||||
charge_logs=None, capacity_tests=None, pct_logs=None):
|
||||
|
||||
@@ -6,7 +6,6 @@ ha_client/ha_poller branches, export/import edge cases, bulk actions.
|
||||
|
||||
import io
|
||||
import json
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
|
||||
@@ -484,7 +484,8 @@ def test_poll_skips_update_when_percentage_unchanged(ha_app, ha_client_f):
|
||||
engine = create_engine(ha_app.config["SQLALCHEMY_DATABASE_URI"])
|
||||
s = sessionmaker(bind=engine)()
|
||||
s.get(Battery, 1).battery_percentage = 50
|
||||
s.commit(); s.close()
|
||||
s.commit()
|
||||
s.close()
|
||||
|
||||
from ha_client import HomeAssistantClient
|
||||
from ha_poller import HaPoller
|
||||
|
||||
Reference in New Issue
Block a user