|
|
@ -143,13 +143,14 @@ class TestTemplateEngine(): |
|
|
|
|
|
|
|
def test_if_an_input_template_contains_pkg_function_with_existing_package_as_its_argument__it_works_correctly_and_pkg_function_returns_version_value(self): |
|
|
|
input_template = '''{% calculate name = 'filename', force -%} |
|
|
|
{% if pkg('test-category/test-package') < 2.7 -%} |
|
|
|
{% if pkg('test-category/test-package') < 2.3 -%} |
|
|
|
pkg() works correctly. |
|
|
|
{%- else -%} |
|
|
|
pkg() does not work correctly. |
|
|
|
{%- endif -%}''' |
|
|
|
output_text = 'pkg() works correctly.' |
|
|
|
template_engine = TemplateEngine(appends_set=APPENDS_SET) |
|
|
|
template_engine = TemplateEngine(appends_set=APPENDS_SET, |
|
|
|
chroot_path=CHROOT_PATH) |
|
|
|
template_engine.process_template_from_string(input_template, FILE) |
|
|
|
|
|
|
|
text = template_engine.template_text |
|
|
@ -163,7 +164,8 @@ class TestTemplateEngine(): |
|
|
|
pkg() does not work correctly. |
|
|
|
{%- endif -%}''' |
|
|
|
output_text = 'pkg() works correctly.' |
|
|
|
template_engine = TemplateEngine(appends_set=APPENDS_SET) |
|
|
|
template_engine = TemplateEngine(appends_set=APPENDS_SET, |
|
|
|
chroot_path=CHROOT_PATH) |
|
|
|
template_engine.process_template_from_string(input_template, FILE) |
|
|
|
|
|
|
|
text = template_engine.template_text |
|
|
@ -226,11 +228,13 @@ parameter_2 = {{ vars_1.var_1 }}''' |
|
|
|
Variables({'var_1': 'second'})}) |
|
|
|
|
|
|
|
template_engine_1 = TemplateEngine(appends_set=APPENDS_SET, |
|
|
|
datavars_module=datavars_module_1) |
|
|
|
datavars_module=datavars_module_1, |
|
|
|
chroot_path=CHROOT_PATH) |
|
|
|
template_engine_1.process_template_from_string(input_template_1, DIR) |
|
|
|
|
|
|
|
template_engine_2 = TemplateEngine(appends_set=APPENDS_SET, |
|
|
|
datavars_module=datavars_module_2) |
|
|
|
datavars_module=datavars_module_2, |
|
|
|
chroot_path=CHROOT_PATH) |
|
|
|
template_engine_2.process_template_from_string(input_template_2, DIR) |
|
|
|
|
|
|
|
text_1 = template_engine_1.template_text |
|
|
@ -245,14 +249,15 @@ parameter_2 = {{ vars_1.var_1 }}''' |
|
|
|
'test-category/test-package', |
|
|
|
'var_2': 1.2})}) |
|
|
|
input_template = '''{% calculate name = 'filename', force -%} |
|
|
|
{% if pkg(vars_1.var_1) < 2.7 -%} |
|
|
|
{% if pkg(vars_1.var_1) < 4.1 -%} |
|
|
|
pkg() works correctly. |
|
|
|
{%- else -%} |
|
|
|
pkg() does not work correctly. |
|
|
|
{%- endif -%}''' |
|
|
|
output_text = 'pkg() works correctly.' |
|
|
|
template_engine = TemplateEngine(appends_set=APPENDS_SET, |
|
|
|
datavars_module=datavars_module) |
|
|
|
datavars_module=datavars_module, |
|
|
|
chroot_path=CHROOT_PATH) |
|
|
|
template_engine.process_template_from_string(input_template, FILE) |
|
|
|
|
|
|
|
text = template_engine.template_text |
|
|
|