fleet/server/mock/datastore_users.go
Tomas Touceda f8b7a83cc6
Process stored CPEs and store found CVEs (#1533)
* WIP

* WIP

* Make path optional and fix tests

* Add first generate

* Move to nvd package

* remove replace

* Re-add replace

* It's path, not file name

* Change how db path is set and use etag

* Fix typos

* Make db generation faster

* Remove quotes

* Doesn't like comments

* Samitize etag and save to file

* Refactor some things and improve writing of etagenv

* Compress file and truncate amount of items for faster testing

* Remove quotes

* Try to improve performance

* Ignore truncate error if not exists

* Minor cleanup and make sqlite have cpe prefix

* Simplify code and test sync

* Add VCR for sync test

* Check for nvdRelease nil

* Add test for the actual translation

* Address review comments

* Rename generate command because we'll have a cve one too

* Move to its own dir

* Add first cve db generation

* WIP but with final strategy, preparring to merge main

* Fix merge conflicts

* WIP

* wip

* Insert CVEs to the db

* Remove unused code

* Use wg instead of counting

* Call cancelFunc to avoid ctx leak

* Fix logs for better readability

* Point code to fleetdm instead of my repo
2021-08-04 18:01:39 -03:00

99 lines
2.6 KiB
Go

// Automatically generated by mockimpl. DO NOT EDIT!
package mock
import "github.com/fleetdm/fleet/v4/server/fleet"
var _ fleet.UserStore = (*UserStore)(nil)
type NewUserFunc func(user *fleet.User) (*fleet.User, error)
type ListUsersFunc func(opt fleet.UserListOptions) ([]*fleet.User, error)
type UserByEmailFunc func(email string) (*fleet.User, error)
type UserByIDFunc func(id uint) (*fleet.User, error)
type SaveUserFunc func(user *fleet.User) error
type SaveUsersFunc func(users []*fleet.User) error
type DeleteUserFunc func(id uint) error
type PendingEmailChangeFunc func(userID uint, newEmail string, token string) error
type ConfirmPendingEmailChangeFunc func(userID uint, token string) (string, error)
type UserStore struct {
NewUserFunc NewUserFunc
NewUserFuncInvoked bool
ListUsersFunc ListUsersFunc
ListUsersFuncInvoked bool
UserByEmailFunc UserByEmailFunc
UserByEmailFuncInvoked bool
UserByIDFunc UserByIDFunc
UserByIDFuncInvoked bool
SaveUserFunc SaveUserFunc
SaveUserFuncInvoked bool
SaveUsersFunc SaveUsersFunc
SaveUsersFuncInvoked bool
DeleteUserFunc DeleteUserFunc
DeleteUserFuncInvoked bool
PendingEmailChangeFunc PendingEmailChangeFunc
PendingEmailChangeFuncInvoked bool
ConfirmPendingEmailChangeFunc ConfirmPendingEmailChangeFunc
ConfirmPendingEmailChangeFuncInvoked bool
}
func (s *UserStore) NewUser(user *fleet.User) (*fleet.User, error) {
s.NewUserFuncInvoked = true
return s.NewUserFunc(user)
}
func (s *UserStore) ListUsers(opt fleet.UserListOptions) ([]*fleet.User, error) {
s.ListUsersFuncInvoked = true
return s.ListUsersFunc(opt)
}
func (s *UserStore) UserByEmail(email string) (*fleet.User, error) {
s.UserByEmailFuncInvoked = true
return s.UserByEmailFunc(email)
}
func (s *UserStore) UserByID(id uint) (*fleet.User, error) {
s.UserByIDFuncInvoked = true
return s.UserByIDFunc(id)
}
func (s *UserStore) SaveUser(user *fleet.User) error {
s.SaveUserFuncInvoked = true
return s.SaveUserFunc(user)
}
func (s *UserStore) SaveUsers(users []*fleet.User) error {
s.SaveUsersFuncInvoked = true
return s.SaveUsersFunc(users)
}
func (s *UserStore) DeleteUser(id uint) error {
s.DeleteUserFuncInvoked = true
return s.DeleteUserFunc(id)
}
func (s *UserStore) PendingEmailChange(userID uint, newEmail string, token string) error {
s.PendingEmailChangeFuncInvoked = true
return s.PendingEmailChangeFunc(userID, newEmail, token)
}
func (s *UserStore) ConfirmPendingEmailChange(userID uint, token string) (string, error) {
s.ConfirmPendingEmailChangeFuncInvoked = true
return s.ConfirmPendingEmailChangeFunc(userID, token)
}