Open Naveenlbg opened 1 year ago
Sorry for the delay, I missed the notification about this.
You could try adding the following to one of your mock tests:
input_mapping:
level['data']: 1
You might have to play around with it a bit, but basically the input_mapping
param just does string substitution in your model, so you can substitute anything with anything else!
Let me know how it goes.
Hi DBT team,
I can writing a unit test case for dbt macros in which one of the macro has a call statement and get the result(load_result) and perform some business logic , Question : Is there any way i can mock the result of the call statement ?
` {% macro get_max_level(src,product, default=1) -%} {%- if not execute -%} {{ return(default) }} {% endif %} {%- call statement('get_max_level', fetch_result=true) %} SELECT max(level) as level FROM {{ src.database }}.{{ src.schema }}.employee
{%- endcall -%} {%- set level = load_result('get_max_level') -%} {%- if level and level['data'] -%} {%- set level_data = product_level['data'] | map(attribute=0) | list %} {{ return(product_level_data[0] | as_number ) }} {%- else -%} {{ return(default | as_number ) }} {%- endif -%} {%- endmacro %}`