Filters
Grizzly native tempalting filters that can be used to manipulate variable values where they are used.
fromtestdata
@templatingfilter
def fromtestdata(value: NamedTuple) -> dict[str, Any]
Convert testdata object to a dictionary.
Nested testdata is a namedtuple
object, e.g. AtomicCsvReader.test
, where column values are accessed with
AtomicCsvReader.test.header1
. If anything should be done for the whole row/item it must be converted to a
dictionary.
Example:
Given value of variable "AtomicCsvReader.test" is "test.csv"
Then log message "test={{ AtomicCsvReader.test | fromtestdata | stringify }}"
Arguments:
value
NamedTuple - testdata objekt
stringify
@templatingfilter
def stringify(
value: Optional[Union[list[Any], dict[str, Any], str, int,
float]]) -> str
Convert python object to JSON string.
Convert any (valid) python object to a JSON string.
Example:
Given value of variable "AtomicCsvReader.test" is "test.csv"
Then log message "test={{ AtomicCsvReader.test | fromtestdata | stringify }}"
Arguments:
value
JsonSerializable - value to convert to JSON string
b64encode
@templatingfilter
def b64encode(value: str) -> str
Base64 encode string value.
Example:
Given value of variable "input_value" is "foobar"
Then log message "input_value (base64): {{ input_value | b64encode }}"
Arguments:
value
str - value to base64 encode
b64decode
@templatingfilter
def b64decode(value: str) -> str
Base64 decode string value.
Example:
Given value of variable "input_value" is "Zm9vYmFy"
Then log message "input_value: {{ input_value | b64decode }}"
Arguments:
value
str - value to base64 encode