|
|
@@ -219,6 +219,10 @@ def test_http_read_only_manage_permissions_both_clients_and_routes(db, monkeypat
|
|
|
assert client.get(path, params={'month': '2026-10', 'calendarKind': 'alkali'}).json()['total'] == 1
|
|
|
assert client.get(path, params={'month': '2026-10', 'calendarKind': 'salt'}).status_code == 422
|
|
|
assert client.put(f"{path}/{alkali.json()['id']}", json=payload(calendarKind='acid')).status_code == 422
|
|
|
+ other = client.post(path, json=payload(calendarKind='other'))
|
|
|
+ assert other.status_code == 200 and other.json()['calendarKind'] == 'other'
|
|
|
+ assert client.get(path, params={'month': '2026-10', 'calendarKind': 'other'}).json()['total'] == 1
|
|
|
+ assert client.put(f"{path}/{other.json()['id']}", json=payload(calendarKind='alkali')).status_code == 422
|
|
|
engine.dispose()
|
|
|
|
|
|
|
|
|
@@ -278,6 +282,25 @@ def test_acid_and_alkali_calendars_stay_separate(db):
|
|
|
assert kept.destination == '南京' and kept.calendar_kind == 'alkali'
|
|
|
|
|
|
|
|
|
+def test_other_calendar_stays_separate_from_acid_and_alkali(db):
|
|
|
+ _, update, _, svc = modules()
|
|
|
+ create(db) # acid default
|
|
|
+ create(db, calendarKind='alkali', origin='碱库')
|
|
|
+ other = create(db, calendarKind='other', origin='其他库')
|
|
|
+ other_page = svc.list_records(db, 't1', user(), month='2026-10', calendar_kind='other')
|
|
|
+ assert other_page['total'] == 1 and other_page['list'][0]['id'] == other.id
|
|
|
+ assert other_page['list'][0]['calendarKind'] == 'other'
|
|
|
+ assert svc.list_records(db, 't1', user(), month='2026-10')['total'] == 1
|
|
|
+ assert svc.list_records(db, 't1', user(), month='2026-10', calendar_kind='alkali')['total'] == 1
|
|
|
+ with pytest.raises(HTTPException) as moved:
|
|
|
+ svc.update_record(db, 't1', user(), other.id, update(**payload(calendarKind='acid')))
|
|
|
+ assert moved.value.status_code == 422
|
|
|
+ kept = svc.update_record(
|
|
|
+ db, 't1', user(), other.id, update(**payload(calendarKind='other', destination='合肥'))
|
|
|
+ )
|
|
|
+ assert kept.destination == '合肥' and kept.calendar_kind == 'other'
|
|
|
+
|
|
|
+
|
|
|
def test_month_pagination_can_fetch_more_than_500_trips(db):
|
|
|
model, _, _, svc = modules()
|
|
|
db.add_all([model(id=f'bulk-{number:04}', dispatch_date=date(2026, 10, 26),
|