sl.snippet_api.testing package
- sl.snippet_api.testing.generate_collection(**kwargs)
- Generate a Collection for testing - Generates a collection used for testing. Any parameter not supplied will use a sane default value. - Warning - This function should only be used for testing. - Parameters:
- app (Optional[DynamicApp]) – Application definition 
- obj_id (Optional[int]) – Collection ID 
- group (Optional[int]) – Collection group defined by the Dynamic Application. Default: 0 
- devices (Optional[Dict[int, Device]]) – - Dictionary of - Deviceobjects indexed by Device ID- >>> { >>> 50: Device(did=50) >>> } 
- name (Optional[str]) – Collection name. Default: obj name 
- argument (Optional[str]) – Collection argument. Default: “arg” 
- col_class (Optional[int]) – Class / Type for the collection. Default: - GAUGE_CLASS
- snippet_id (Optional[int]) – ID of the snippet tied to this collection 
 
- Return type:
 
- sl.snippet_api.testing.generate_credential(**kwargs)
- Generate a Credential for testing - Generates a credential used for testing. Any parameter not supplied will use a sane default value. Any supplied field is valid and will be pushed into - credential.cred_fields["field"]unless it is identified by- Credential.- Warning - This function should only be used for testing. - Parameters:
- cred_type (Optional[str]) – Type for the credential. Default: - SNMP
- cred_id (Optional[str]) – Type for the credential 
- cred_name (Optional[str]) – Type for the credential. Default: “Mocked Cred” 
- cred_host (Optional[str]) – Type for the credential. Default: “localhost” 
 
- Return type:
 
- sl.snippet_api.testing.generate_device(**kwargs)
- Generate a Device for testing - Generates a device used for testing. Refer to - Devicefor a list of applicable kwargs.- Parameters:
- did (Optional[str]) – Device ID 
- cred (Optional[str]) – Credential aligned to the Device 
- ip (Optional[str]) – IP address for the device 
- name (Optional[str]) – Device Name 
 
- Return type:
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.generate_dynamic_app(**kwargs)
- Generates an example Dynamic Application - Refer to - DynamicAppfor a list of applicable kwargs.- Return type:
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.get_app_id()
- Increments and returns the next Application ID - Return type:
- int
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.get_cred_id()
- Increments and returns the next Credential ID - Return type:
- int
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.get_did()
- Increments and returns the next Device ID - Return type:
- int
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.get_obj_id()
- Increments and returns the next Object ID - Return type:
- int
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.increment_snippet_id()
- Increments and returns the next Object ID - This should be called when you want to generate a new snippet_id for a snippet. - Return type:
- int
 - Warning - This function should only be used for testing. 
- sl.snippet_api.testing.reset_secrets()
- Remove all secrets from Log Redactor - Return type:
- None
 - Warning - This function should only be used for testing.