Add unified shift reporting
This commit is contained in:
1 parent
1b060377aa
commit
41a5ae7a63
30 files changed
+3751
-9
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import re
|
||||
import traceback
|
||||
from dataclasses import FrozenInstanceError, replace
|
||||
from datetime import UTC, datetime
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from unittest.mock import MagicMock
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -90,8 +91,9 @@ def test_valid_row_and_resource_lifecycle(db):
|
||||
assert status.production_order == '12026000815'
|
||||
assert status.article_number == '212520'
|
||||
assert status.article_description == 'Stex R 1501 C (PR) 5,80 x 50 m'
|
||||
assert status.feedback_timestamp is NOW
|
||||
assert status.feedback_timestamp.tzinfo is None
|
||||
assert status.feedback_timestamp.isoformat() == '2026-09-04T21:20:50+02:00'
|
||||
assert status.feedback_timestamp.tzinfo == ZoneInfo('Europe/Berlin')
|
||||
assert status.feedback_timestamp.utcoffset() == timedelta(hours=2)
|
||||
assert (status.order_quantity_m2, status.good_quantity_m2, status.remaining_quantity_m2,
|
||||
status.remaining_time_hours, status.remaining_rolls) == (
|
||||
80040., 69281., 10759., 17., 38.,
|
||||
@@ -117,6 +119,8 @@ def test_leading_whitespace_and_timezone_preserved(db):
|
||||
assert (status.workplace, status.production_order, status.article_number,
|
||||
status.article_description) == (' K7', ' K 7-001', ' 001', ' description')
|
||||
assert status.feedback_timestamp is row[4]
|
||||
assert status.feedback_timestamp.tzinfo is UTC
|
||||
assert status.feedback_timestamp.isoformat() == '2026-09-04T21:20:50+00:00'
|
||||
|
||||
|
||||
def test_nullable_fields(db):
|
||||
@@ -185,3 +189,13 @@ def test_driver_errors_are_safe(db, stage):
|
||||
assert 'private-password' not in rendered
|
||||
if stage != 'connect':
|
||||
connect.return_value.__exit__.assert_called_once()
|
||||
|
||||
|
||||
def test_naive_winter_timestamp_uses_berlin_standard_time(db):
|
||||
row = list(ROW)
|
||||
row[4] = datetime(2026, 1, 4, 21, 20, 50)
|
||||
db[2].fetchmany.return_value = [row]
|
||||
status = read().get_current_workplace_status('K7')
|
||||
assert status.feedback_timestamp.isoformat() == '2026-01-04T21:20:50+01:00'
|
||||
assert status.feedback_timestamp.tzinfo == ZoneInfo('Europe/Berlin')
|
||||
assert status.feedback_timestamp.utcoffset() == timedelta(hours=1)
|
||||
Reference in new issue
Block a user