feat: 实现门店套餐分配功能并统一测试基础设施
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m30s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m30s
新增功能: - 门店套餐分配管理(shop_package_allocation):支持门店套餐库存管理 - 门店套餐系列分配管理(shop_series_allocation):支持套餐系列分配和佣金层级设置 - 我的套餐查询(my_package):支持门店查询自己的套餐分配情况 测试改进: - 统一集成测试基础设施,新增 testutils.NewIntegrationTestEnv - 重构所有集成测试使用新的测试环境设置 - 移除旧的测试辅助函数和冗余测试文件 - 新增 test_helpers_test.go 统一任务测试辅助 技术细节: - 新增数据库迁移 000025_create_shop_allocation_tables - 新增 3 个 Handler、Service、Store 和对应的单元测试 - 更新 OpenAPI 文档和文档生成器 - 测试覆盖率:Service 层 > 90% Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,13 +9,13 @@ import (
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/response"
|
||||
"github.com/break/junhong_cmp_fiber/tests/testutils"
|
||||
"github.com/break/junhong_cmp_fiber/tests/testutils/integ"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAuthorization_List(t *testing.T) {
|
||||
env := testutils.NewIntegrationTestEnv(t)
|
||||
env := integ.NewIntegrationTestEnv(t)
|
||||
|
||||
ts := time.Now().Unix() % 100000
|
||||
shop := env.CreateTestShop("AUTH_TEST_SHOP", 1, nil)
|
||||
@@ -121,7 +121,7 @@ func TestAuthorization_List(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAuthorization_GetDetail(t *testing.T) {
|
||||
env := testutils.NewIntegrationTestEnv(t)
|
||||
env := integ.NewIntegrationTestEnv(t)
|
||||
|
||||
ts := time.Now().Unix() % 100000
|
||||
shop := env.CreateTestShop("AUTH_TEST_SHOP", 1, nil)
|
||||
@@ -164,7 +164,7 @@ func TestAuthorization_GetDetail(t *testing.T) {
|
||||
data := result.Data.(map[string]interface{})
|
||||
assert.Equal(t, float64(auth1.ID), data["id"])
|
||||
assert.Equal(t, float64(enterprise.ID), data["enterprise_id"])
|
||||
assert.Equal(t, "AUTH_TEST_ENTERPRISE", data["enterprise_name"])
|
||||
assert.Equal(t, enterprise.EnterpriseName, data["enterprise_name"])
|
||||
assert.Equal(t, card1.ICCID, data["iccid"])
|
||||
assert.Equal(t, "集成测试授权记录", data["remark"])
|
||||
assert.Equal(t, float64(1), data["status"])
|
||||
@@ -185,7 +185,7 @@ func TestAuthorization_GetDetail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAuthorization_UpdateRemark(t *testing.T) {
|
||||
env := testutils.NewIntegrationTestEnv(t)
|
||||
env := integ.NewIntegrationTestEnv(t)
|
||||
|
||||
ts := time.Now().Unix() % 100000
|
||||
shop := env.CreateTestShop("AUTH_TEST_SHOP", 1, nil)
|
||||
@@ -245,7 +245,7 @@ func TestAuthorization_UpdateRemark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAuthorization_DataPermission(t *testing.T) {
|
||||
env := testutils.NewIntegrationTestEnv(t)
|
||||
env := integ.NewIntegrationTestEnv(t)
|
||||
|
||||
ts := time.Now().Unix() % 100000
|
||||
shop := env.CreateTestShop("AUTH_TEST_SHOP", 1, nil)
|
||||
@@ -348,7 +348,7 @@ func TestAuthorization_DataPermission(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAuthorization_Unauthorized(t *testing.T) {
|
||||
env := testutils.NewIntegrationTestEnv(t)
|
||||
env := integ.NewIntegrationTestEnv(t)
|
||||
|
||||
t.Run("无Token访问被拒绝", func(t *testing.T) {
|
||||
resp, err := env.ClearAuth().Request("GET", "/api/admin/authorizations", nil)
|
||||
|
||||
Reference in New Issue
Block a user