Skip to content

Commit

Permalink
Adjust Product & Version display on TestRun page
Browse files Browse the repository at this point in the history
use the relationship TR->Build as the starting point because TR->Plan
is much more likely to update its Product/Version values in the future.

NOTE: the field `product_version` which is removed from tests doesn't
make sense because neither the underlying forms, not the underlying
models have such a field.
  • Loading branch information
atodorov committed Dec 3, 2023
1 parent d70dc11 commit 61ef60d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tcms/templates/email/post_run_save/email.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
{% blocktrans with pk=test_run.pk run_url=test_run.get_full_url plan_url=test_run.plan.get_full_url summary=test_run.summary manager=test_run.manager default_tester=test_run.default_tester product=test_run.plan.product version=test_run.plan.product_version build=test_run.build notes=test_run.notes %}Test run {{ pk }} has been created or updated for you.
{% blocktrans with pk=test_run.pk run_url=test_run.get_full_url plan_url=test_run.plan.get_full_url summary=test_run.summary manager=test_run.manager default_tester=test_run.default_tester product=test_run.build.version.product version=test_run.build.version build=test_run.build notes=test_run.notes %}Test run {{ pk }} has been created or updated for you.

### Links ###
Test run: {{ run_url }}
Expand Down
8 changes: 4 additions & 4 deletions tcms/testruns/templates/testruns/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ <h2 class="card-pf-title" style="text-align: left">

<h2 class="card-pf-title" style="text-align: left">
<span class="fa fa-shopping-cart"></span>{% trans 'Product' %}:
<a href="{% url 'testruns-search' %}?product={{ object.plan.product_id }}" title="Search test runs of {{ object.plan.product }}">{{ object.plan.product }}</a>
<a href="{% url 'testruns-search' %}?product={{ object.build.version.product_id }}" title="Search test runs of {{ object.build.version.product }}">{{ object.build.version.product }}</a>
</h2>

<h2 class="card-pf-title" style="text-align: left">
<span class="fa fa-random"></span>{% trans 'Version' %}:
<a href="{% url 'testruns-search' %}?product={{ object.plan.product_id }}&version={{ object.plan.product_version_id }}" title="Search test runs of {{ object.plan.product_version.value }}">{{ object.plan.product_version.value }}</a>
<a href="{% url 'testruns-search' %}?product={{ object.build.version.product_id }}&version={{ object.build.version_id }}" title="Search test runs of {{ object.build.version.value }}">{{ object.build.version.value }}</a>
</h2>

<h2 class="card-pf-title" style="text-align: left">
<span class="fa fa-wrench"></span>{% trans 'Build' %}:
<a href="{% url 'testruns-search' %}?product={{ object.plan.product_id }}&version={{ object.plan.product_version_id }}&build={{ object.build_id }}" title="Search test runs of {{ object.build }}">{{ object.build }}</a>
<a href="{% url 'testruns-search' %}?product={{ object.build.version.product_id }}&version={{ object.build.version_id }}&build={{ object.build_id }}" title="Search test runs of {{ object.build }}">{{ object.build }}</a>
</h2>

<h2 class="card-pf-title" style="text-align: left">
Expand Down Expand Up @@ -295,7 +295,7 @@ <h2 class="card-pf-title">
</button>

<button class="btn btn-default"
href="{% url 'testcases-search' %}?product={{ object.plan.product_id }}{% for status in confirmed_statuses %}&case_status={{ status.pk }}{% endfor %}"
href="{% url 'testcases-search' %}?product={{ object.build.version.product_id }}{% for status in confirmed_statuses %}&case_status={{ status.pk }}{% endfor %}"
id="btn-search-cases" title="{% trans 'Advanced search' %}">
<span class="fa fa-search"></span>
</button>
Expand Down
1 change: 0 additions & 1 deletion tcms/testruns/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def setUpTestData(cls):
"manager": cls.test_run.manager.email,
"default_tester": intern.email,
"notes": "New run notes",
"product_version": cls.test_run.plan.product_version.pk,
"plan": cls.test_run.plan.pk,
}
super().setUpTestData()
Expand Down
4 changes: 2 additions & 2 deletions tcms/testruns/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def test_post_creates_new_run(self):
post_data = {
"summary": new_run_summary,
"plan": self.plan.pk,
"product_id": self.plan.product_id,
"product": self.plan.product_id,
"product_id": self.build.version.product_id,
"product": self.build.version.product_id,
"build": self.build.pk,
"manager": self.tester.email,
"default_tester": self.tester.email,
Expand Down

0 comments on commit 61ef60d

Please sign in to comment.