diff --git a/tcms/issuetracker/base.py b/tcms/issuetracker/base.py index 5ab4edc6f1..8f58567442 100644 --- a/tcms/issuetracker/base.py +++ b/tcms/issuetracker/base.py @@ -90,14 +90,17 @@ def _report_comment(self, execution, user=None): # pylint: disable=no-self-use {reporter} **Product:** -{execution.run.plan.product.name} +{execution.build.version.product.name} -**Component(s):** -{self.get_case_components(execution.case)} +**Version:** +{execution.build.version.value} -**Version-Release number** (if applicable): +**Build:** {execution.build.name} +**Component(s):** +{self.get_case_components(execution.case)} + **Steps to reproduce**: {txt} diff --git a/tcms/issuetracker/bugzilla_integration.py b/tcms/issuetracker/bugzilla_integration.py index 7d6f389038..449af326a8 100644 --- a/tcms/issuetracker/bugzilla_integration.py +++ b/tcms/issuetracker/bugzilla_integration.py @@ -78,9 +78,9 @@ def _report_issue(self, execution, user): to a URL with some of the values pre-defined as query parameters! """ args = { - "product": execution.run.plan.product.name, + "product": execution.build.version.product.name, "component": self.get_case_components(execution.case), - "version": execution.run.plan.product_version.value, + "version": execution.build.version.value, "short_desc": f"Test case failure: {execution.case.summary}", "comment": self._report_comment(execution, user), } diff --git a/tcms/issuetracker/kiwitcms.py b/tcms/issuetracker/kiwitcms.py index fa834900b2..d74f0d09d2 100644 --- a/tcms/issuetracker/kiwitcms.py +++ b/tcms/issuetracker/kiwitcms.py @@ -69,8 +69,8 @@ def _report_issue(self, execution, user): data = { "reporter": user, "summary": f"Failed test: {execution.case.summary}", - "product": execution.run.plan.product, - "version": execution.run.plan.product_version, + "product": execution.build.version.product, + "version": execution.build.version, "build": execution.build, "text": self._report_comment(execution, user), "_execution": execution, diff --git a/tcms/issuetracker/tests/test_azureboards.py b/tcms/issuetracker/tests/test_azureboards.py index c4769a951c..9d20e2237a 100644 --- a/tcms/issuetracker/tests/test_azureboards.py +++ b/tcms/issuetracker/tests/test_azureboards.py @@ -122,7 +122,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_bitbucket.py b/tcms/issuetracker/tests/test_bitbucket.py index 4ed867bff8..6b73d4bdbb 100644 --- a/tcms/issuetracker/tests/test_bitbucket.py +++ b/tcms/issuetracker/tests/test_bitbucket.py @@ -111,7 +111,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_bugzilla.py b/tcms/issuetracker/tests/test_bugzilla.py index 10587ba1af..61a8094527 100644 --- a/tcms/issuetracker/tests/test_bugzilla.py +++ b/tcms/issuetracker/tests/test_bugzilla.py @@ -105,6 +105,9 @@ def test_report_issue_from_test_execution_falls_back_to_query_params(self): test_case.save() # will generate history object test_run = TestRunFactory(plan=test_plan) + test_run.build.version = version + test_run.build.save() + execution2 = TestExecutionFactory( run=test_run, case=test_case, build=test_run.build ) @@ -144,6 +147,9 @@ def test_report_issue_from_test_execution_1click_works(self): test_case.save() # will generate history object test_run = TestRunFactory(plan=test_plan) + test_run.build.version = version + test_run.build.save() + execution2 = TestExecutionFactory( run=test_run, case=test_case, build=test_run.build ) diff --git a/tcms/issuetracker/tests/test_github.py b/tcms/issuetracker/tests/test_github.py index 4cefb11746..4bea326e47 100644 --- a/tcms/issuetracker/tests/test_github.py +++ b/tcms/issuetracker/tests/test_github.py @@ -151,7 +151,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_gitlab_com.py b/tcms/issuetracker/tests/test_gitlab_com.py index d91703f393..8902df0601 100644 --- a/tcms/issuetracker/tests/test_gitlab_com.py +++ b/tcms/issuetracker/tests/test_gitlab_com.py @@ -136,7 +136,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_gitlab_ee.py b/tcms/issuetracker/tests/test_gitlab_ee.py index 12f235c51a..5a5ce694de 100644 --- a/tcms/issuetracker/tests/test_gitlab_ee.py +++ b/tcms/issuetracker/tests/test_gitlab_ee.py @@ -175,7 +175,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_jira.py b/tcms/issuetracker/tests/test_jira.py index baac555dae..8b28ad64f4 100644 --- a/tcms/issuetracker/tests/test_jira.py +++ b/tcms/issuetracker/tests/test_jira.py @@ -34,8 +34,8 @@ def _fixture_setup(self): self.execution_1.run.save() # this is the name of the Project in JIRA. Key is "KT" - self.execution_1.run.plan.product.name = "Kiwi TCMS" - self.execution_1.run.plan.product.save() + self.execution_1.build.version.product.name = "Kiwi TCMS" + self.execution_1.build.version.product.save() self.component = ComponentFactory( name="JIRA integration", product=self.execution_1.run.plan.product @@ -129,7 +129,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_kiwitcms.py b/tcms/issuetracker/tests/test_kiwitcms.py index fe34d2597e..9787cd63e0 100644 --- a/tcms/issuetracker/tests/test_kiwitcms.py +++ b/tcms/issuetracker/tests/test_kiwitcms.py @@ -106,7 +106,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/tests/test_redmine.py b/tcms/issuetracker/tests/test_redmine.py index 7acd3f5323..22fe89b5f4 100644 --- a/tcms/issuetracker/tests/test_redmine.py +++ b/tcms/issuetracker/tests/test_redmine.py @@ -33,8 +33,8 @@ def _fixture_setup(self): self.execution_1.case.save() # will generate history object # this is the name of the Redmine Project - self.execution_1.run.plan.product.name = "Integration with Kiwi TCMS" - self.execution_1.run.plan.product.save() + self.execution_1.build.version.product.name = "Integration with Kiwi TCMS" + self.execution_1.build.version.product.save() self.component = ComponentFactory( name="Redmine integration", product=self.execution_1.run.plan.product @@ -129,7 +129,7 @@ def test_report_issue_from_test_execution_1click_works(self): for expected_string in [ f"Filed from execution {self.execution_1.get_full_url()}", "Reporter", - self.execution_1.run.plan.product.name, + self.execution_1.build.version.product.name, self.component.name, "Steps to reproduce", self.execution_1.case.text, diff --git a/tcms/issuetracker/types.py b/tcms/issuetracker/types.py index ded4fedfac..b5788f0390 100644 --- a/tcms/issuetracker/types.py +++ b/tcms/issuetracker/types.py @@ -107,7 +107,7 @@ def get_project_from_jira(self, execution): .. versionadded:: 11.4 """ - search_for = execution.run.plan.product.name.lower() + search_for = execution.build.version.product.name.lower() projects_in_jira = self.rpc.projects() for project in self.rpc.projects(): if (project.name.lower() == search_for) or ( diff --git a/tcms/rpc/api/testrun.py b/tcms/rpc/api/testrun.py index 122fdd13ca..144d1546dc 100644 --- a/tcms/rpc/api/testrun.py +++ b/tcms/rpc/api/testrun.py @@ -242,8 +242,6 @@ def filter(query=None): # pylint: disable=redefined-builtin TestRun.objects.filter(**query) .values( "id", - "plan__product_version", - "plan__product_version__value", "start_date", "stop_date", "planned_start", @@ -251,10 +249,12 @@ def filter(query=None): # pylint: disable=redefined-builtin "summary", "notes", "plan", - "plan__product", "plan__name", "build", "build__name", + "build__version", + "build__version__value", + "build__version__product", "manager", "manager__username", "default_tester", diff --git a/tcms/rpc/tests/test_testrun.py b/tcms/rpc/tests/test_testrun.py index c33fee6372..aa451b9d92 100644 --- a/tcms/rpc/tests/test_testrun.py +++ b/tcms/rpc/tests/test_testrun.py @@ -442,12 +442,13 @@ def test_filter(self): result = result[0] self.assertEqual(result["id"], self.test_run.pk) + self.assertEqual(result["build__version"], self.test_run.build.version.pk) self.assertEqual( - result["plan__product_version"], self.test_run.plan.product_version.pk + result["build__version__value"], + self.test_run.build.version.value, ) self.assertEqual( - result["plan__product_version__value"], - self.test_run.plan.product_version.value, + result["build__version__product"], self.test_run.build.version.product.pk ) self.assertEqual(result["start_date"], self.test_run.start_date) self.assertEqual(result["stop_date"], self.test_run.stop_date) diff --git a/tcms/telemetry/static/telemetry/js/testing/execution-dashboard.js b/tcms/telemetry/static/telemetry/js/testing/execution-dashboard.js index 389c19fed2..741d3b763a 100644 --- a/tcms/telemetry/static/telemetry/js/testing/execution-dashboard.js +++ b/tcms/telemetry/static/telemetry/js/testing/execution-dashboard.js @@ -14,12 +14,12 @@ export function drawTable () { const productIds = $('#id_product').val() if (productIds.length) { - query.run__plan__product__in = productIds + query.build__version__product__in = productIds } const versionIds = $('#id_version').val() if (versionIds.length) { - query.run__plan__product_version__in = versionIds + query.build__version__in = versionIds } const buildIds = $('#id_build').val() diff --git a/tcms/telemetry/static/telemetry/js/testing/execution-trends.js b/tcms/telemetry/static/telemetry/js/testing/execution-trends.js index b6637f418b..f6a8362383 100644 --- a/tcms/telemetry/static/telemetry/js/testing/execution-trends.js +++ b/tcms/telemetry/static/telemetry/js/testing/execution-trends.js @@ -6,12 +6,12 @@ export function drawChart () { const productIds = $('#id_product').val() if (productIds.length) { - query.run__plan__product__in = productIds + query.build__version__product__in = productIds } const versionIds = $('#id_version').val() if (versionIds.length) { - query.run__plan__product_version__in = versionIds + query.build__version__in = versionIds } const buildIds = $('#id_build').val() diff --git a/tcms/telemetry/static/telemetry/js/testing/status-matrix.js b/tcms/telemetry/static/telemetry/js/testing/status-matrix.js index 49bfc5f2d8..cc5fad051c 100644 --- a/tcms/telemetry/static/telemetry/js/testing/status-matrix.js +++ b/tcms/telemetry/static/telemetry/js/testing/status-matrix.js @@ -44,12 +44,12 @@ export function drawTable () { const productIds = $('#id_product').val() if (productIds.length) { - query.run__plan__product__in = productIds + query.build__version__product__in = productIds } const versionIds = $('#id_version').val() if (versionIds.length) { - query.run__plan__product_version__in = versionIds + query.build__version__in = versionIds } const buildIds = $('#id_build').val() diff --git a/tcms/telemetry/static/telemetry/js/testing/test-case-health.js b/tcms/telemetry/static/telemetry/js/testing/test-case-health.js index 2457ff3ac7..daed060455 100644 --- a/tcms/telemetry/static/telemetry/js/testing/test-case-health.js +++ b/tcms/telemetry/static/telemetry/js/testing/test-case-health.js @@ -9,12 +9,12 @@ export function initializePage () { const productIds = $('#id_product').val() if (productIds.length) { - query.run__plan__product__in = productIds + query.build__version__product__in = productIds } const versionIds = $('#id_version').val() if (versionIds.length) { - query.run__plan__product_version__in = versionIds + query.build__version__in = versionIds } const buildIds = $('#id_build').val() diff --git a/tcms/templates/email/post_run_save/email.txt b/tcms/templates/email/post_run_save/email.txt index b8950bb300..18933539b1 100644 --- a/tcms/templates/email/post_run_save/email.txt +++ b/tcms/templates/email/post_run_save/email.txt @@ -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 }} diff --git a/tcms/testruns/static/testruns/js/search.js b/tcms/testruns/static/testruns/js/search.js index 7b206e56ae..b8bbe2c68c 100644 --- a/tcms/testruns/static/testruns/js/search.js +++ b/tcms/testruns/static/testruns/js/search.js @@ -9,10 +9,10 @@ import { function preProcessData (data, callbackF) { const runIds = [] - const planIds = [] + const productIds = [] data.forEach(function (element) { runIds.push(element.id) - planIds.push(element.plan) + productIds.push(element.build__version__product) }) // get tags for all objects @@ -29,7 +29,7 @@ function preProcessData (data, callbackF) { } }) - jsonRPC('Product.filter', { plan__in: planIds }, function (products) { + jsonRPC('Product.filter', { pk__in: productIds }, function (products) { products = arrayToDict(products) // augment data set with additional info @@ -39,8 +39,7 @@ function preProcessData (data, callbackF) { } else { element.tag = [] } - - element.product_name = products[element.plan__product].name + element.product_name = products[element.build__version__product].name }) callbackF({ data }) // renders everything @@ -104,11 +103,11 @@ export function pageTestrunsSearchReadyHandler () { } if ($('#id_product').val()) { - params.plan__product = $('#id_product').val() + params.build__version__product = $('#id_product').val() }; if ($('#id_version').val()) { - params.plan__product_version = $('#id_version').val() + params.build__version = $('#id_version').val() }; if ($('#id_build').val()) { @@ -148,7 +147,7 @@ export function pageTestrunsSearchReadyHandler () { } }, { data: 'product_name' }, - { data: 'plan__product_version__value' }, + { data: 'build__version__value' }, { data: 'build__name' }, { data: 'start_date' }, { data: 'stop_date' }, diff --git a/tcms/testruns/templates/testruns/get.html b/tcms/testruns/templates/testruns/get.html index 0b6478d404..5e77f3ebec 100644 --- a/tcms/testruns/templates/testruns/get.html +++ b/tcms/testruns/templates/testruns/get.html @@ -42,17 +42,17 @@