From ced9928a5d8c7c7f4f7cf69ef8a53a036d693b15 Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Wed, 29 Apr 2020 11:57:55 +0200
Subject: [PATCH] atc: Rename the precondition variables to match the testcase
 entry

Use names for the precondition variables that reflect the properties in
the testcase definitions so it's easier to spot what's going on.

This will alos make it easier to later expand them to use multiple
values.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 atc_renderer/renderer.py              |  8 ++++----
 atc_renderer/templates/test_case.html | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/atc_renderer/renderer.py b/atc_renderer/renderer.py
index 385a3c5..447ae1e 100644
--- a/atc_renderer/renderer.py
+++ b/atc_renderer/renderer.py
@@ -170,7 +170,7 @@ def get_template_values(testcase_data):
         if deps:
             # A install.deps directive will always add a preconditions section
             # to install the required packages using the macro to install packages.
-            template_values.update({ 'packages_list' : ' '.join(deps) })
+            template_values.update({ 'install_packages_preconditions' : ' '.join(deps) })
 
     # No mandatory fields
     for nm in ['notes', 'format', 'maintainer', 'resources',
@@ -185,15 +185,15 @@ def get_template_values(testcase_data):
     # Macros variables
     ostree_preconditions = metadata.get('macro_ostree_preconditions')
     if ostree_preconditions:
-        template_values.update({ 'pkgname' : ostree_preconditions })
+        template_values.update({ 'ostree_preconditions' : ostree_preconditions })
 
     packages_list = metadata.get('macro_install_packages_preconditions')
     if packages_list:
-        template_values.update({ 'packages_list' :  packages_list })
+        template_values.update({ 'install_packages_preconditions' :  packages_list })
 
     modules_preconditions = metadata.get('macro_modules_preconditions')
     if modules_preconditions:
-        template_values.update({ 'libname' : modules_preconditions })
+        template_values.update({ 'modules_preconditions' : modules_preconditions })
 
     return template_values
 
diff --git a/atc_renderer/templates/test_case.html b/atc_renderer/templates/test_case.html
index b958413..bb0a698 100644
--- a/atc_renderer/templates/test_case.html
+++ b/atc_renderer/templates/test_case.html
@@ -36,14 +36,14 @@
       </ul>
       {% endif %}
 
-      {% if pre_conditions or pkgname or packages_list or libname or git_repo_url %}
+      {% if pre_conditions or ostree_preconditions or install_packages_preconditions or modules_preconditions or git_repo_url %}
       <hr />
       <h4>Pre Conditions</h4>
       <ol>
-      {% if pkgname %}{{ macros.ostree_preconditions(pkgname) }}{% endif %}
-      {% if packages_list %}{{ macros.install_packages(packages_list) }}{% endif %}
-      {% if libname %}{{ macros.modules_preconditions(libname) }}{% endif %}
-      {% if git_repo_url and not pkgname %}{{ macros.git_repo(git_repo_url, git_repo_dir, git_repo_branch) }}{% endif %}
+      {% if ostree_preconditions %}{{ macros.ostree_preconditions(ostree_preconditions) }}{% endif %}
+      {% if install_packages_preconditions %}{{ macros.install_packages(install_packages_preconditions) }}{% endif %}
+      {% if modules_preconditions %}{{ macros.modules_preconditions(modules_preconditions) }}{% endif %}
+      {% if git_repo_url and not ostree_preconditions %}{{ macros.git_repo(git_repo_url, git_repo_dir, git_repo_branch) }}{% endif %}
       {% for comment, command, output, _, link in pre_conditions %}
       {% if comment %}<li class="mb-sm-2">{{ comment|e }}</li>{% endif %}
       {% if command %}<p><kbd>{{ command|e }}</kbd></p>{% endif %}
-- 
GitLab