catcher.modules.filter_impl package¶
Submodules¶
catcher.modules.filter_impl module¶
-
catcher.modules.filter_impl.bifs.
filter_asdate
(data, date_format='%Y-%m-%d %H:%M:%S.%f')[source]¶ Convert timestamp to date F.e.
- echo: {from: '{{ timestamp_var | asdate(date_format="%Y-%m-%d") }}', to: two.output}
Parameters: - data – timestamp to be converted to a date
- date_format – expected data format.
-
catcher.modules.filter_impl.bifs.
filter_asdict
(param)[source]¶ Convert data to dict F.e.
- check: {equals: {the: [1, 2], is: '{{ ([("one", 1), ("two", 2)] | asdict).values() |aslist }}'}}
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_asfloat
(param)[source]¶ Convert data to float F.e.
- check: {equals: {the: 36.6, is: '{{ "36.6" | asfloat }}'}}
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_asint
(param)[source]¶ Convert data to int F.e.
- postgres: request: conf: '{{ postgres_conf }}' query: "select status from my_table where id == {{ my_str_var |asint }}"
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_aslist
(param)[source]¶ Convert data to list F.e.
- loop: foreach: in: '{{ my_dictionary |aslist }}' do: echo: {from: '{{ ITEM.value }}', to: '{{ ITEM.key }}.output'}
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_asstr
(param)[source]¶ Convert data to string F.e.
- check: {equals: {the: '17', is: '{{ my_int | asstr }}'}}
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_astimestamp
(data, date_format='%Y-%m-%d %H:%M:%S.%f')[source]¶ Convert date to timestamp. Date can be either python date object or date string F.e.
- echo: {from: '{{ date_time_var | astimestamp }}', to: two.output}
Parameters: - data – date time object (or string representation) to be converted to a timestamp.
- date_format – date format (in case it is a string)
-
catcher.modules.filter_impl.bifs.
filter_astuple
(param)[source]¶ Convert data to tuple F.e.
- postgres: request: conf: '{{ postgres_conf }}' query: "select status from my_table where id in {{ [1, 2, 3] |astuple }}"
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_b64decode
(param)[source]¶ Decode base64 encoded string F.e.
- echo: '{{ token |b64decode }}'
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_b64encode
(param)[source]¶ Encode string as base64 F.e.
- http: post: url: '{{ auth_service }}/oauth/token' headers: {Authorization: '{{ admin_token | b64encode }}'}
Parameters: param – data to convert
-
catcher.modules.filter_impl.bifs.
filter_hash
(data, alg='md5')[source]¶ Filter for hashing data. F.e.
- echo: {from: '{{ my_var | hash("sha1") }}', to: two.output}
Parameters: - data – data to hash
- alg – algorithm to use
-
catcher.modules.filter_impl.bifs.
function_now
(date_format='%Y-%m-%d %H:%M:%S.%f')[source]¶ Get current date in a specified format. F.e.
- echo: {from: '{{ now("%Y-%m-%d") }}', to: year.output}
Parameters: date_format – date format
-
catcher.modules.filter_impl.bifs.
function_now_ts
()[source]¶ Get current date time in as a timestamp. F.e.
- echo: {from: '{{ now_ts() }}', to: timestamp.output}
-
catcher.modules.filter_impl.bifs.
function_random
(param, locale=None)[source]¶ Call Faker and return it’s result. Is used to generate random data. F.e.
- echo: {from: '{{ random("email") }}', to: one.output}
Parameters: - param – Faker’s provider name.
- locale – Faker’s locale param