bec_lib.tests.utils.ClientMock#
- class ClientMock(*args, forced=False, **kwargs)[source]#
Bases:
BECClient
Initialize the BECClient
- Parameters:
config (ServiceConfig, optional) – The configuration for the client. Defaults to None.
connector_cls (ConnectorBase, optional) – The connector class to use. Defaults to None.
wait_for_server (bool, optional) – Whether to wait for the server to be available before starting. Defaults to False.
forced (bool, optional) – Whether to force the initialization of a new client. Defaults to False.
Methods
get the next alarm with at least the specified severity
remove all alarms from stack
Delete a global variable from Redis
unload / remove loaded user scripts from builtins.
unload / remove a user scripts.
Get a global variable from Redis
Get all available global variables
display all currently loaded user functions
Load all scripts from the scripts directory.
Load a high level interface module.
load a user script file and import all its definitions
Set a global variable through Redis
print all unhandled alarms
show_all_commands
shutdown the client and all its components
start the client
wait_for_service
Attributes
get the currently active target (e)account
currently stored pre-scan macros
get the status of active services
started
get the current BECService status
get the current username
- property active_account: str#
get the currently active target (e)account
- alarms(severity=Alarms.WARNING)#
get the next alarm with at least the specified severity
- clear_all_alarms()#
remove all alarms from stack
- delete_global_var(name: str) None #
Delete a global variable from Redis
- Parameters:
name (str) – Name of the variable
- forget_all_user_scripts() None #
unload / remove loaded user scripts from builtins. Files will remain untouched.
Runs a callback of type EventType.NAMESPACE_UPDATE to inform clients about removing objects from the namesapce.
- forget_user_script(name: str) None #
unload / remove a user scripts. The file will remain on disk.
- get_global_var(name: str) Any #
Get a global variable from Redis
- Parameters:
name (str) – Name of the variable
- Returns:
Value of the variable
- Return type:
Any
- global_vars() str #
Get all available global variables
- list_user_scripts()#
display all currently loaded user functions
- load_all_user_scripts() None #
Load all scripts from the scripts directory.
Runs a callback of type EventType.NAMESPACE_UPDATE to inform clients about added objects in the namesapce.
- load_high_level_interface(module_name: str) None #
Load a high level interface module. Runs a callback of type EventType.NAMESPACE_UPDATE to inform clients about added objects in the namesapce.
- Parameters:
module_name (str) – The name of the module to load
- load_user_script(file: str) None #
load a user script file and import all its definitions
- Parameters:
file (str) – Full path to the script file.
- property pre_scan_macros#
currently stored pre-scan macros
- property service_status#
get the status of active services
- set_global_var(name: str, val: Any) None #
Set a global variable through Redis
- Parameters:
name (str) – Name of the variable
val (Any) – Value of the variable
- show_all_alarms(severity=Alarms.WARNING)#
print all unhandled alarms
- shutdown()#
shutdown the client and all its components
- start()#
start the client
- property username: str#
get the current username