Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
5cad90fb
Unverified
Commit
5cad90fb
authored
Dec 30, 2025
by
程序猿MT
Committed by
GitHub
Dec 30, 2025
Browse files
Merge branch 'Wei-Shaw:main' into main
parents
8cb2d3b3
ec87f39d
Changes
3
Hide whitespace changes
Inline
Side-by-side
backend/internal/repository/fixtures_integration_test.go
View file @
5cad90fb
...
@@ -390,4 +390,3 @@ func mustBindAccountToGroup(t *testing.T, client *dbent.Client, accountID, group
...
@@ -390,4 +390,3 @@ func mustBindAccountToGroup(t *testing.T, client *dbent.Client, accountID, group
Save
(
ctx
)
Save
(
ctx
)
require
.
NoError
(
t
,
err
,
"create account_group"
)
require
.
NoError
(
t
,
err
,
"create account_group"
)
}
}
backend/internal/repository/user_repo_integration_test.go
View file @
5cad90fb
...
@@ -76,8 +76,8 @@ func (s *UserRepoSuite) mustCreateSubscription(userID, groupID int64, mutate fun
...
@@ -76,8 +76,8 @@ func (s *UserRepoSuite) mustCreateSubscription(userID, groupID int64, mutate fun
create
:=
s
.
client
.
UserSubscription
.
Create
()
.
create
:=
s
.
client
.
UserSubscription
.
Create
()
.
SetUserID
(
userID
)
.
SetUserID
(
userID
)
.
SetGroupID
(
groupID
)
.
SetGroupID
(
groupID
)
.
SetStartsAt
(
now
.
Add
(
-
1
*
time
.
Hour
))
.
SetStartsAt
(
now
.
Add
(
-
1
*
time
.
Hour
))
.
SetExpiresAt
(
now
.
Add
(
24
*
time
.
Hour
))
.
SetExpiresAt
(
now
.
Add
(
24
*
time
.
Hour
))
.
SetStatus
(
service
.
SubscriptionStatusActive
)
.
SetStatus
(
service
.
SubscriptionStatusActive
)
.
SetAssignedAt
(
now
)
.
SetAssignedAt
(
now
)
.
SetNotes
(
""
)
SetNotes
(
""
)
...
@@ -507,4 +507,3 @@ func (s *UserRepoSuite) TestCRUD_And_Filters_And_AtomicUpdates() {
...
@@ -507,4 +507,3 @@ func (s *UserRepoSuite) TestCRUD_And_Filters_And_AtomicUpdates() {
s
.
Require
()
.
Len
(
users
,
1
,
"ListWithFilters len mismatch"
)
s
.
Require
()
.
Len
(
users
,
1
,
"ListWithFilters len mismatch"
)
s
.
Require
()
.
Equal
(
user2
.
ID
,
users
[
0
]
.
ID
,
"ListWithFilters result mismatch"
)
s
.
Require
()
.
Equal
(
user2
.
ID
,
users
[
0
]
.
ID
,
"ListWithFilters result mismatch"
)
}
}
backend/internal/service/api_key_service_delete_test.go
View file @
5cad90fb
...
@@ -146,8 +146,8 @@ func TestApiKeyService_Delete_OwnerMismatch(t *testing.T) {
...
@@ -146,8 +146,8 @@ func TestApiKeyService_Delete_OwnerMismatch(t *testing.T) {
err
:=
svc
.
Delete
(
context
.
Background
(),
10
,
2
)
// API Key ID=10, 调用者 userID=2
err
:=
svc
.
Delete
(
context
.
Background
(),
10
,
2
)
// API Key ID=10, 调用者 userID=2
require
.
ErrorIs
(
t
,
err
,
ErrInsufficientPerms
)
require
.
ErrorIs
(
t
,
err
,
ErrInsufficientPerms
)
require
.
Empty
(
t
,
repo
.
deletedIDs
)
// 验证删除操作未被调用
require
.
Empty
(
t
,
repo
.
deletedIDs
)
// 验证删除操作未被调用
require
.
Empty
(
t
,
cache
.
invalidated
)
// 验证缓存未被清除
require
.
Empty
(
t
,
cache
.
invalidated
)
// 验证缓存未被清除
}
}
// TestApiKeyService_Delete_Success 测试所有者成功删除 API Key 的场景。
// TestApiKeyService_Delete_Success 测试所有者成功删除 API Key 的场景。
...
@@ -164,7 +164,7 @@ func TestApiKeyService_Delete_Success(t *testing.T) {
...
@@ -164,7 +164,7 @@ func TestApiKeyService_Delete_Success(t *testing.T) {
err
:=
svc
.
Delete
(
context
.
Background
(),
42
,
7
)
// API Key ID=42, 调用者 userID=7
err
:=
svc
.
Delete
(
context
.
Background
(),
42
,
7
)
// API Key ID=42, 调用者 userID=7
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
[]
int64
{
42
},
repo
.
deletedIDs
)
// 验证正确的 API Key 被删除
require
.
Equal
(
t
,
[]
int64
{
42
},
repo
.
deletedIDs
)
// 验证正确的 API Key 被删除
require
.
Equal
(
t
,
[]
int64
{
7
},
cache
.
invalidated
)
// 验证所有者的缓存被清除
require
.
Equal
(
t
,
[]
int64
{
7
},
cache
.
invalidated
)
// 验证所有者的缓存被清除
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment