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 AddFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) (vfs.BaseVirtualFolder, []byte, error)
- func AddGroup(group dataprovider.Group, expectedStatusCode int) (dataprovider.Group, []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 GetBanTime(ip string, expectedStatusCode int) (map[string]any, []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 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 GetScore(ip string, expectedStatusCode int) (map[string]any, []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 RemoveFolder(folder vfs.BaseVirtualFolder, expectedStatusCode int) ([]byte, error)
- func RemoveGroup(group dataprovider.Group, 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 []common.FolderRetention, expectedStatusCode int) ([]byte, error)
- func UnbanIP(ip string, expectedStatusCode int) error
- func UpdateAPIKey(apiKey dataprovider.APIKey, expectedStatusCode int) (dataprovider.APIKey, []byte, error)
- func UpdateAdmin(admin dataprovider.Admin, expectedStatusCode int) (dataprovider.Admin, []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 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 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 ¶ added in v2.3.0
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 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 GetBanTime ¶
GetBanTime returns the ban time for the given IP address
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 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 ¶ added in v2.3.0
GetGroupByName gets a group by name and checks the received HTTP Status code against expectedStatusCode.
func GetGroups ¶ added in v2.3.0
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 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 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 ¶ added in v2.3.0
func RemoveGroup(group dataprovider.Group, expectedStatusCode int) ([]byte, error)
RemoveGroup removes an existing group 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 []common.FolderRetention, expectedStatusCode int) ([]byte, error)
StartRetentionCheck starts a new retention check
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 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 ¶ added in v2.3.0
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 UpdateTransferQuotaUsage ¶ added in v2.3.0
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.