mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-25 01:59:07 +02:00
cli,hscontrol: use ID-based preauthkey operations
This commit is contained in:
committed by
Kristoffer Dalby
parent
8631581852
commit
1325fd8b27
@@ -41,7 +41,7 @@ func TestCreatePreAuthKey(t *testing.T) {
|
||||
assert.NotEmpty(t, key.Key)
|
||||
|
||||
// List keys for the user
|
||||
keys, err := db.ListPreAuthKeys(types.UserID(user.ID))
|
||||
keys, err := db.ListPreAuthKeys()
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, keys, 1)
|
||||
|
||||
@@ -49,15 +49,6 @@ func TestCreatePreAuthKey(t *testing.T) {
|
||||
assert.Equal(t, user.ID, keys[0].User.ID)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "error_list_invalid_user_id",
|
||||
test: func(t *testing.T, db *HSDatabase) {
|
||||
t.Helper()
|
||||
|
||||
_, err := db.ListPreAuthKeys(1000000)
|
||||
assert.Error(t, err)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -101,7 +92,7 @@ func TestPreAuthKeyACLTags(t *testing.T) {
|
||||
_, err = db.CreatePreAuthKey(user.TypedID(), false, false, nil, tagsWithDuplicate)
|
||||
require.NoError(t, err)
|
||||
|
||||
listedPaks, err := db.ListPreAuthKeys(types.UserID(user.ID))
|
||||
listedPaks, err := db.ListPreAuthKeys()
|
||||
require.NoError(t, err)
|
||||
require.Len(t, listedPaks, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user