Documentation ¶
Overview ¶
Package httpdtest provides utilities for testing the exposed REST API.
Index ¶
- func AddAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) (dataprovider.APIKey, []byte, error)
- func AddAdmin(admin dataprovider.Admin, expectedStatusCode int) (dataprovider.Admin, []byte, error)
- func AddEventAction(action dataprovider.BaseEventAction, expectedStatusCode int) (dataprovider.BaseEventAction, []byte, error)
- func AddEventRule(rule dataprovider.EventRule, expectedStatusCode int) (dataprovider.EventRule, []byte, error)
- func AddFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) (vfs.BaseVirtualFolder, []byte, error)
- func AddGroup(group dataprovider.Group, expectedStatusCode int) (dataprovider.Group, []byte, error)
- func AddRole(role dataprovider.Role, expectedStatusCode int) (dataprovider.Role, []byte, error)
- func AddUser(user dataprovider.User, expectedStatusCode int) (dataprovider.User, []byte, error)
- func ChangeAdminPassword(currentPassword, newPassword string, expectedStatusCode int) ([]byte, error)
- func CloseConnection(connectionID string, expectedStatusCode int) ([]byte, error)
- func Dumpdata(outputFile, outputData, indent string, expectedStatusCode int) (map[string]any, []byte, error)
- func GetAPIKeyByID(keyID string, expectedStatusCode int) (dataprovider.APIKey, []byte, error)
- func GetAPIKeys(limit, offset int64, expectedStatusCode int) ([]dataprovider.APIKey, []byte, error)
- func GetAdminByUsername(username string, expectedStatusCode int) (dataprovider.Admin, []byte, error)
- func GetAdmins(limit, offset int64, expectedStatusCode int) ([]dataprovider.Admin, []byte, error)
- func GetConnections(expectedStatusCode int) ([]common.ConnectionStatus, []byte, error)
- func GetDefenderHostByIP(ip string, expectedStatusCode int) (dataprovider.DefenderEntry, []byte, error)
- func GetDefenderHosts(expectedStatusCode int) ([]dataprovider.DefenderEntry, []byte, error)
- func GetEventActionByName(name string, expectedStatusCode int) (dataprovider.BaseEventAction, []byte, error)
- func GetEventActions(limit, offset int64, expectedStatusCode int) ([]dataprovider.BaseEventAction, []byte, error)
- func GetEventRuleByName(name string, expectedStatusCode int) (dataprovider.EventRule, []byte, error)
- func GetEventRules(limit, offset int64, expectedStatusCode int) ([]dataprovider.EventRule, []byte, error)
- func GetFolderByName(name string, expectedStatusCode int) (vfs.BaseVirtualFolder, []byte, error)
- func GetFolders(limit int64, offset int64, expectedStatusCode int) ([]vfs.BaseVirtualFolder, []byte, error)
- func GetFoldersQuotaScans(expectedStatusCode int) ([]common.ActiveVirtualFolderQuotaScan, []byte, error)
- func GetGroupByName(name string, expectedStatusCode int) (dataprovider.Group, []byte, error)
- func GetGroups(limit, offset int64, expectedStatusCode int) ([]dataprovider.Group, []byte, error)
- func GetQuotaScans(expectedStatusCode int) ([]common.ActiveQuotaScan, []byte, error)
- func GetRetentionChecks(expectedStatusCode int) ([]common.ActiveRetentionChecks, []byte, error)
- func GetRoleByName(name string, expectedStatusCode int) (dataprovider.Role, []byte, error)
- func GetRoles(limit, offset int64, expectedStatusCode int) ([]dataprovider.Role, []byte, error)
- func GetStatus(expectedStatusCode int) (httpd.ServicesStatus, []byte, error)
- func GetToken(username, password string) (string, map[string]any, error)
- func GetUserByUsername(username string, expectedStatusCode int) (dataprovider.User, []byte, error)
- func GetUsers(limit, offset int64, expectedStatusCode int) ([]dataprovider.User, []byte, error)
- func GetVersion(expectedStatusCode int) (version.Info, []byte, error)
- func Loaddata(inputFile, scanQuota, mode string, expectedStatusCode int) (map[string]any, []byte, error)
- func LoaddataFromPostBody(data []byte, scanQuota, mode string, expectedStatusCode int) (map[string]any, []byte, error)
- func RemoveAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) ([]byte, error)
- func RemoveAdmin(admin dataprovider.Admin, expectedStatusCode int) ([]byte, error)
- func RemoveDefenderHostByIP(ip string, expectedStatusCode int) ([]byte, error)
- func RemoveEventAction(action dataprovider.BaseEventAction, expectedStatusCode int) ([]byte, error)
- func RemoveEventRule(rule dataprovider.EventRule, expectedStatusCode int) ([]byte, error)
- func RemoveFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) ([]byte, error)
- func RemoveGroup(group dataprovider.Group, expectedStatusCode int) ([]byte, error)
- func RemoveRole(role dataprovider.Role, expectedStatusCode int) ([]byte, error)
- func RemoveUser(user dataprovider.User, expectedStatusCode int) ([]byte, error)
- func SetBaseURL(url string)
- func SetJWTToken(token string)
- func StartFolderQuotaScan(folder vfs.BaseVirtualFolder, expectedStatusCode int) ([]byte, error)
- func StartQuotaScan(user dataprovider.User, expectedStatusCode int) ([]byte, error)
- func StartRetentionCheck(username string, retention []dataprovider.FolderRetention, ...) ([]byte, error)
- func StartTestHTTPFs(port int) error
- func StartTestHTTPFsOverUnixSocket(socketPath string) error
- func UpdateAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) (dataprovider.APIKey, []byte, error)
- func UpdateAdmin(admin dataprovider.Admin, expectedStatusCode int) (dataprovider.Admin, []byte, error)
- func UpdateEventAction(action dataprovider.BaseEventAction, expectedStatusCode int) (dataprovider.BaseEventAction, []byte, error)
- func UpdateEventRule(rule dataprovider.EventRule, expectedStatusCode int) (dataprovider.EventRule, []byte, error)
- func UpdateFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) (vfs.BaseVirtualFolder, []byte, error)
- func UpdateFolderQuotaUsage(folder vfs.BaseVirtualFolder, mode string, expectedStatusCode int) ([]byte, error)
- func UpdateGroup(group dataprovider.Group, expectedStatusCode int) (dataprovider.Group, []byte, error)
- func UpdateQuotaUsage(user dataprovider.User, mode string, expectedStatusCode int) ([]byte, error)
- func UpdateRole(role dataprovider.Role, expectedStatusCode int) (dataprovider.Role, []byte, error)
- func UpdateTransferQuotaUsage(user dataprovider.User, mode string, expectedStatusCode int) ([]byte, error)
- func UpdateUser(user dataprovider.User, expectedStatusCode int, disconnect string) (dataprovider.User, []byte, error)
- func UpdateUserWithJSON(user dataprovider.User, expectedStatusCode int, disconnect string, ...) (dataprovider.User, []byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAPIKey ¶
func AddAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) (dataprovider.APIKey, []byte, error)
AddAPIKey adds a new API key and checks the received HTTP Status code against expectedStatusCode.
func AddAdmin ¶
func AddAdmin(admin dataprovider.Admin, expectedStatusCode int) (dataprovider.Admin, []byte, error)
AddAdmin adds a new admin and checks the received HTTP Status code against expectedStatusCode.
func AddEventAction ¶
func AddEventAction(action dataprovider.BaseEventAction, expectedStatusCode int) (dataprovider.BaseEventAction, []byte, error)
AddEventAction adds a new event action
func AddEventRule ¶
func AddEventRule(rule dataprovider.EventRule, expectedStatusCode int) (dataprovider.EventRule, []byte, error)
AddEventRule adds a new event rule
func AddFolder ¶
func AddFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) (vfs.BaseVirtualFolder, []byte, error)
AddFolder adds a new folder and checks the received HTTP Status code against expectedStatusCode
func AddGroup ¶
func AddGroup(group dataprovider.Group, expectedStatusCode int) (dataprovider.Group, []byte, error)
AddGroup adds a new group and checks the received HTTP Status code against expectedStatusCode.
func AddRole ¶
func AddRole(role dataprovider.Role, expectedStatusCode int) (dataprovider.Role, []byte, error)
AddRole adds a new role and checks the received HTTP Status code against expectedStatusCode.
func AddUser ¶
func AddUser(user dataprovider.User, expectedStatusCode int) (dataprovider.User, []byte, error)
AddUser adds a new user and checks the received HTTP Status code against expectedStatusCode.
func ChangeAdminPassword ¶
func ChangeAdminPassword(currentPassword, newPassword string, expectedStatusCode int) ([]byte, error)
ChangeAdminPassword changes the password for an existing admin
func CloseConnection ¶
CloseConnection closes an active connection identified by connectionID
func Dumpdata ¶
func Dumpdata(outputFile, outputData, indent string, expectedStatusCode int) (map[string]any, []byte, error)
Dumpdata requests a backup to outputFile. outputFile is relative to the configured backups_path
func GetAPIKeyByID ¶
GetAPIKeyByID gets a API key by ID and checks the received HTTP Status code against expectedStatusCode.
func GetAPIKeys ¶
GetAPIKeys returns a list of API keys and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetAdminByUsername ¶
func GetAdminByUsername(username string, expectedStatusCode int) (dataprovider.Admin, []byte, error)
GetAdminByUsername gets an admin by username and checks the received HTTP Status code against expectedStatusCode.
func GetAdmins ¶
GetAdmins returns a list of admins and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetConnections ¶
func GetConnections(expectedStatusCode int) ([]common.ConnectionStatus, []byte, error)
GetConnections returns status and stats for active SFTP/SCP connections
func GetDefenderHostByIP ¶
func GetDefenderHostByIP(ip string, expectedStatusCode int) (dataprovider.DefenderEntry, []byte, error)
GetDefenderHostByIP returns the host with the given IP, if it exists
func GetDefenderHosts ¶
func GetDefenderHosts(expectedStatusCode int) ([]dataprovider.DefenderEntry, []byte, error)
GetDefenderHosts returns hosts that are banned or for which some violations have been detected
func GetEventActionByName ¶
func GetEventActionByName(name string, expectedStatusCode int) (dataprovider.BaseEventAction, []byte, error)
GetEventActionByName gets an event action by name and checks the received HTTP Status code against expectedStatusCode.
func GetEventActions ¶
func GetEventActions(limit, offset int64, expectedStatusCode int) ([]dataprovider.BaseEventAction, []byte, error)
GetEventActions returns a list of event actions and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetEventRuleByName ¶
func GetEventRuleByName(name string, expectedStatusCode int) (dataprovider.EventRule, []byte, error)
GetEventRuleByName gets an event rule by name and checks the received HTTP Status code against expectedStatusCode.
func GetEventRules ¶
func GetEventRules(limit, offset int64, expectedStatusCode int) ([]dataprovider.EventRule, []byte, error)
GetEventRules returns a list of event rules and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetFolderByName ¶
GetFolderByName gets a folder by name and checks the received HTTP Status code against expectedStatusCode.
func GetFolders ¶
func GetFolders(limit int64, offset int64, expectedStatusCode int) ([]vfs.BaseVirtualFolder, []byte, error)
GetFolders returns a list of folders and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset. The results can be filtered specifying a folder path, the folder path filter is an exact match
func GetFoldersQuotaScans ¶
func GetFoldersQuotaScans(expectedStatusCode int) ([]common.ActiveVirtualFolderQuotaScan, []byte, error)
GetFoldersQuotaScans gets active quota scans for folders and checks the received HTTP Status code against expectedStatusCode.
func GetGroupByName ¶
GetGroupByName gets a group by name and checks the received HTTP Status code against expectedStatusCode.
func GetGroups ¶
GetGroups returns a list of groups and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetQuotaScans ¶
func GetQuotaScans(expectedStatusCode int) ([]common.ActiveQuotaScan, []byte, error)
GetQuotaScans gets active quota scans for users and checks the received HTTP Status code against expectedStatusCode.
func GetRetentionChecks ¶
func GetRetentionChecks(expectedStatusCode int) ([]common.ActiveRetentionChecks, []byte, error)
GetRetentionChecks returns the active retention checks
func GetRoleByName ¶
GetRoleByName gets a role by name and checks the received HTTP Status code against expectedStatusCode.
func GetRoles ¶
GetRoles returns a list of roles and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetStatus ¶
func GetStatus(expectedStatusCode int) (httpd.ServicesStatus, []byte, error)
GetStatus returns the server status
func GetUserByUsername ¶
GetUserByUsername gets a user by username and checks the received HTTP Status code against expectedStatusCode.
func GetUsers ¶
GetUsers returns a list of users and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset.
func GetVersion ¶
GetVersion returns version details
func Loaddata ¶
func Loaddata(inputFile, scanQuota, mode string, expectedStatusCode int) (map[string]any, []byte, error)
Loaddata restores a backup.
func LoaddataFromPostBody ¶
func LoaddataFromPostBody(data []byte, scanQuota, mode string, expectedStatusCode int) (map[string]any, []byte, error)
LoaddataFromPostBody restores a backup
func RemoveAPIKey ¶
func RemoveAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) ([]byte, error)
RemoveAPIKey removes an existing API key and checks the received HTTP Status code against expectedStatusCode.
func RemoveAdmin ¶
func RemoveAdmin(admin dataprovider.Admin, expectedStatusCode int) ([]byte, error)
RemoveAdmin removes an existing admin and checks the received HTTP Status code against expectedStatusCode.
func RemoveDefenderHostByIP ¶
RemoveDefenderHostByIP removes the host with the given IP from the defender list
func RemoveEventAction ¶
func RemoveEventAction(action dataprovider.BaseEventAction, expectedStatusCode int) ([]byte, error)
RemoveEventAction removes an existing action and checks the received HTTP Status code against expectedStatusCode.
func RemoveEventRule ¶
func RemoveEventRule(rule dataprovider.EventRule, expectedStatusCode int) ([]byte, error)
RemoveEventRule removes an existing rule and checks the received HTTP Status code against expectedStatusCode.
func RemoveFolder ¶
func RemoveFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) ([]byte, error)
RemoveFolder removes an existing user and checks the received HTTP Status code against expectedStatusCode.
func RemoveGroup ¶
func RemoveGroup(group dataprovider.Group, expectedStatusCode int) ([]byte, error)
RemoveGroup removes an existing group and checks the received HTTP Status code against expectedStatusCode.
func RemoveRole ¶
func RemoveRole(role dataprovider.Role, expectedStatusCode int) ([]byte, error)
RemoveRole removes an existing role and checks the received HTTP Status code against expectedStatusCode.
func RemoveUser ¶
func RemoveUser(user dataprovider.User, expectedStatusCode int) ([]byte, error)
RemoveUser removes an existing user and checks the received HTTP Status code against expectedStatusCode.
func SetBaseURL ¶
func SetBaseURL(url string)
SetBaseURL sets the base url to use for HTTP requests. Default URL is "http://127.0.0.1:8080"
func StartFolderQuotaScan ¶
func StartFolderQuotaScan(folder vfs.BaseVirtualFolder, expectedStatusCode int) ([]byte, error)
StartFolderQuotaScan start a new quota scan for the given folder and checks the received HTTP Status code against expectedStatusCode.
func StartQuotaScan ¶
func StartQuotaScan(user dataprovider.User, expectedStatusCode int) ([]byte, error)
StartQuotaScan starts a new quota scan for the given user and checks the received HTTP Status code against expectedStatusCode.
func StartRetentionCheck ¶
func StartRetentionCheck(username string, retention []dataprovider.FolderRetention, expectedStatusCode int) ([]byte, error)
StartRetentionCheck starts a new retention check
func StartTestHTTPFs ¶
StartTestHTTPFs starts a test HTTP service that implements httpfs and listens on the specified port
func StartTestHTTPFsOverUnixSocket ¶
StartTestHTTPFsOverUnixSocket starts a test HTTP service that implements httpfs and listens on the specified UNIX domain socket path
func UpdateAPIKey ¶
func UpdateAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) (dataprovider.APIKey, []byte, error)
UpdateAPIKey updates an existing API key and checks the received HTTP Status code against expectedStatusCode
func UpdateAdmin ¶
func UpdateAdmin(admin dataprovider.Admin, expectedStatusCode int) (dataprovider.Admin, []byte, error)
UpdateAdmin updates an existing admin and checks the received HTTP Status code against expectedStatusCode
func UpdateEventAction ¶
func UpdateEventAction(action dataprovider.BaseEventAction, expectedStatusCode int) (dataprovider.BaseEventAction, []byte, error)
UpdateEventAction updates an existing event action
func UpdateEventRule ¶
func UpdateEventRule(rule dataprovider.EventRule, expectedStatusCode int) (dataprovider.EventRule, []byte, error)
UpdateEventRule updates an existing event rule
func UpdateFolder ¶
func UpdateFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) (vfs.BaseVirtualFolder, []byte, error)
UpdateFolder updates an existing folder and checks the received HTTP Status code against expectedStatusCode.
func UpdateFolderQuotaUsage ¶
func UpdateFolderQuotaUsage(folder vfs.BaseVirtualFolder, mode string, expectedStatusCode int) ([]byte, error)
UpdateFolderQuotaUsage updates the folder used quota limits and checks the received HTTP Status code against expectedStatusCode.
func UpdateGroup ¶
func UpdateGroup(group dataprovider.Group, expectedStatusCode int) (dataprovider.Group, []byte, error)
UpdateGroup updates an existing group and checks the received HTTP Status code against expectedStatusCode
func UpdateQuotaUsage ¶
UpdateQuotaUsage updates the user used quota limits and checks the received HTTP Status code against expectedStatusCode.
func UpdateRole ¶
func UpdateRole(role dataprovider.Role, expectedStatusCode int) (dataprovider.Role, []byte, error)
UpdateRole updates an existing role and checks the received HTTP Status code against expectedStatusCode
func UpdateTransferQuotaUsage ¶
func UpdateTransferQuotaUsage(user dataprovider.User, mode string, expectedStatusCode int) ([]byte, error)
UpdateTransferQuotaUsage updates the user used transfer quota limits and checks the received HTTP Status code against expectedStatusCode.
func UpdateUser ¶
func UpdateUser(user dataprovider.User, expectedStatusCode int, disconnect string) (dataprovider.User, []byte, error)
UpdateUser updates an existing user and checks the received HTTP Status code against expectedStatusCode.
func UpdateUserWithJSON ¶
func UpdateUserWithJSON(user dataprovider.User, expectedStatusCode int, disconnect string, userAsJSON []byte) (dataprovider.User, []byte, error)
UpdateUserWithJSON update a user using the provided JSON as POST body
Types ¶
This section is empty.