feat(shipping-notice): 添加 RPA 工作者心跳告警开关,更新环境配置以支持样本证据历史记录
This commit is contained in:
1 parent
705971ad03
commit
88408490d7
34 files changed
+1697
-109
No files matched your search
@@ -176,3 +176,33 @@ def test_inventory_source_api_saves_new_source_disabled_and_activation_reports_m
|
||||
error = parse_api_error(activation.get_json())
|
||||
assert error['code'] == 'SHIPPING.INVENTORY_SOURCE_ACTIVATION_BLOCKED'
|
||||
assert error['details']['missing_requirements'] == ['parsing_profile', 'excel_template', 'configuration_test']
|
||||
|
||||
|
||||
def test_latest_inventory_configuration_test_is_admin_only(app, client):
|
||||
"""最近测试状态仅允许管理员读取,且没有测试记录时仍返回标准空数据 envelope。"""
|
||||
app.config['AUTH_JWT_REQUIRED'] = False
|
||||
with app.app_context():
|
||||
_create_users()
|
||||
profile = ShippingRpaProfile(
|
||||
profile_code='API_LATEST_TEST_LOGIN', display_name='Latest Test', connector_type='dbs',
|
||||
login_url='https://example.invalid', login_config_json={'auth_mode': 'password'}, enabled=True,
|
||||
)
|
||||
db.session.add(profile)
|
||||
source = ShippingInventorySource(
|
||||
source_code='API_LATEST_TEST_SOURCE', display_name='Latest Test Source', connector_type='dbs',
|
||||
rpa_profile=profile, warehouse_resolution_mode='fixed', fixed_warehouse_id='DUB',
|
||||
report_path_json={'program_group': 'Bison', 'program_label': 'AWSBI', 'report_group': 'Inventory', 'report_name': 'On Hand'},
|
||||
query_parameters_json=[], match_aliases_json=[], enabled=False,
|
||||
)
|
||||
db.session.add(source)
|
||||
db.session.commit()
|
||||
source_id = source.id
|
||||
|
||||
forbidden = client.get(f'/api/admin/shipping-notice/sources/{source_id}/test-export/latest')
|
||||
assert forbidden.status_code in {401, 403}
|
||||
response = client.get(
|
||||
f'/api/admin/shipping-notice/sources/{source_id}/test-export/latest',
|
||||
headers=_headers('inventory-admin', 'admin'),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert parse_api_data(response.get_json()) is None
|
||||
Reference in new issue
Block a user