All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m39s
- 新增店铺角色管理 API 和数据模型 - 实现角色继承和权限检查逻辑 - 添加流程测试框架和集成测试 - 更新权限服务和账号管理逻辑 - 添加数据库迁移脚本 - 归档 OpenSpec 变更文档 Ultraworked with Sisyphus
79 lines
2.4 KiB
Python
79 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
import re
|
|
|
|
# 1. Fix internal/service/account/service_test.go
|
|
print("Fixing service_test.go...")
|
|
with open('internal/service/account/service_test.go', 'r') as f:
|
|
content = f.read()
|
|
|
|
content = re.sub(
|
|
r'(\taccountRoleStore := postgres\.NewAccountRoleStore\(tx, rdb\)\n)',
|
|
r'\1\tshopRoleStore := postgres.NewShopRoleStore(tx, rdb)\n',
|
|
content,
|
|
count=1
|
|
)
|
|
|
|
content = re.sub(
|
|
r'New\(accountStore, roleStore, accountRoleStore, (&MockShopStore{[^}]*}), (&MockEnterpriseStore{[^}]*}), (&MockAuditService{[^}]*})\)',
|
|
r'New(accountStore, roleStore, accountRoleStore, nil, \1, \2, \3)',
|
|
content
|
|
)
|
|
|
|
with open('internal/service/account/service_test.go', 'w') as f:
|
|
f.write(content)
|
|
print("✓ Fixed service_test.go")
|
|
|
|
# 2. Fix tests/unit/permission_check_test.go
|
|
print("Fixing permission_check_test.go...")
|
|
with open('tests/unit/permission_check_test.go', 'r') as f:
|
|
content = f.read()
|
|
|
|
content = re.sub(
|
|
r'permission\.New\(permissionStore, accountRoleStore, rolePermStore, rdb\)',
|
|
'permission.New(permissionStore, accountRoleStore, rolePermStore, nil, rdb)',
|
|
content
|
|
)
|
|
|
|
with open('tests/unit/permission_check_test.go', 'w') as f:
|
|
f.write(content)
|
|
print("✓ Fixed permission_check_test.go")
|
|
|
|
# 3. Fix tests/unit/permission_cache_test.go
|
|
print("Fixing permission_cache_test.go...")
|
|
with open('tests/unit/permission_cache_test.go', 'r') as f:
|
|
content = f.read()
|
|
|
|
content = re.sub(
|
|
r'permission\.New\(permissionStore, accountRoleStore, rolePermStore, rdb\)',
|
|
'permission.New(permissionStore, accountRoleStore, rolePermStore, nil, rdb)',
|
|
content
|
|
)
|
|
|
|
with open('tests/unit/permission_cache_test.go', 'w') as f:
|
|
f.write(content)
|
|
print("✓ Fixed permission_cache_test.go")
|
|
|
|
# 4. Fix tests/unit/shop_service_test.go
|
|
print("Fixing shop_service_test.go...")
|
|
with open('tests/unit/shop_service_test.go', 'r') as f:
|
|
content = f.read()
|
|
|
|
content = re.sub(
|
|
r'(\taccountStore := postgres\.NewAccountStore\(tx, rdb\)\n)',
|
|
r'\1\tshopRoleStore := postgres.NewShopRoleStore(tx, rdb)\n\troleStore := postgres.NewRoleStore(tx)\n',
|
|
content,
|
|
count=1
|
|
)
|
|
|
|
content = re.sub(
|
|
r'shop\.New\(shopStore, accountStore\)',
|
|
'shop.New(shopStore, accountStore, shopRoleStore, roleStore)',
|
|
content
|
|
)
|
|
|
|
with open('tests/unit/shop_service_test.go', 'w') as f:
|
|
f.write(content)
|
|
print("✓ Fixed shop_service_test.go")
|
|
|
|
print("\nAll files fixed!")
|