mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
4f4185372d
This is just to pass down the context to the datastore layer, it doesn't use it just yet - this will be in a follow-up PR.
33 lines
674 B
Go
33 lines
674 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestUserDelete(t *testing.T) {
|
|
server, ds := runServerWithMockedDS(t)
|
|
defer server.Close()
|
|
|
|
ds.UserByEmailFunc = func(ctx context.Context, email string) (*fleet.User, error) {
|
|
return &fleet.User{
|
|
ID: 42,
|
|
Name: "test1",
|
|
Email: "user1@test.com",
|
|
}, nil
|
|
}
|
|
|
|
deletedUser := uint(0)
|
|
|
|
ds.DeleteUserFunc = func(ctx context.Context, id uint) error {
|
|
deletedUser = id
|
|
return nil
|
|
}
|
|
|
|
assert.Equal(t, "", runAppForTest(t, []string{"user", "delete", "--email", "user1@test.com"}))
|
|
assert.Equal(t, uint(42), deletedUser)
|
|
}
|