dy-dashboard/tests/test_new_product_freight.py
2026-10-28 11:14:17 +08:00

18 lines
1.1 KiB
Python

"""新品成品管理是否含运字段。"""
import unittest
from pathlib import Path
R=Path(__file__).resolve().parents[1]
ROUTE=(R/'routes/products.py').read_text(encoding='utf-8')
APP=(R/'static/js/app.js').read_text(encoding='utf-8')
FIELD=(R/'services/field_perms.py').read_text(encoding='utf-8')
class T(unittest.TestCase):
def test_database_field_and_compat_migration(self):
self.assertIn('freight_included',ROUTE);self.assertIn('AFTER quote_pack_img',ROUTE)
def test_column_is_right_of_packaging_quote(self):
a=APP.index("field: 'quote_pack_img'");b=APP.index("field: 'freight_included'",a);c=APP.index("field: 'procurement_planner'",b);self.assertLess(a,b);self.assertLess(b,c)
def test_add_edit_form_is_yes_no_select(self):
self.assertIn("{field: 'freight_included', label: '是否含运', type: 'select', options: ['是', '否']}",APP)
def test_export_and_field_permissions_include_field(self):
self.assertIn("'freight_included': ('freight_included', '是否含运')",ROUTE);self.assertIn("('product_new', '是否含运'): ['freight_included']",FIELD)
if __name__=='__main__':unittest.main()