Skip to content

Commit c601c95

Browse files
committed
1-click bug report will now use execution.build.version.product
after latest changes in Kiwi TCMS, see: kiwitcms/Kiwi@48a33a7 kiwitcms/Kiwi#3439
1 parent 17f4684 commit c601c95

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

trackers_integration/issuetracker/mantis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def is_adding_testcase_to_issue_disabled(self):
138138
def get_project_from_mantis(self, product_name):
139139
"""
140140
Returns a Project from the Mantis BT database.
141-
Will try to match execution.run.plan.product.name or
141+
Will try to match execution.build.version.product.name or
142142
``MANTIS_PROJECT_NAME`` configuration setting! Otherwise will
143143
return the first project found!
144144
@@ -175,7 +175,9 @@ def _report_issue(self, execution, user):
175175
try:
176176
project = self.get_project_from_mantis(
177177
getattr(
178-
settings, "MANTIS_PROJECT_NAME", execution.run.plan.product.name
178+
settings,
179+
"MANTIS_PROJECT_NAME",
180+
execution.build.version.product.name,
179181
)
180182
)
181183
category = self.get_category_from_mantis(

trackers_integration/issuetracker/openproject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022-2023 Alexander Todorov <[email protected]>
1+
# Copyright (c) 2022-2024 Alexander Todorov <[email protected]>
22
#
33
# Licensed under the GPL 3.0: https://www.gnu.org/licenses/gpl-3.0.txt
44

@@ -185,7 +185,7 @@ def get_workpackage_category(self, project_id, name):
185185
raise RuntimeError("WorkPackage Category not found") from err
186186

187187
def _report_issue(self, execution, user):
188-
project = self.get_project_by_name(execution.run.plan.product.name)
188+
project = self.get_project_by_name(execution.build.version.product.name)
189189
project_id = project["id"]
190190
project_identifier = project["identifier"]
191191

trackers_integration/tests/test_mantis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _fixture_setup(self):
2626
self.execution_1.run.save()
2727

2828
self.component = ComponentFactory(
29-
name="Mantis integration", product=self.execution_1.run.plan.product
29+
name="Mantis integration", product=self.execution_1.build.version.product
3030
)
3131
self.execution_1.case.add_component(self.component)
3232

@@ -143,7 +143,7 @@ def test_report_issue_from_test_execution_1click_works(self):
143143
for expected_string in [
144144
f"Filed from execution {self.execution_1.get_full_url()}",
145145
"Reporter",
146-
self.execution_1.run.plan.product.name,
146+
self.execution_1.build.version.product.name,
147147
self.component.name,
148148
"Steps to reproduce",
149149
self.execution_1.case.text,

trackers_integration/tests/test_openproject.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022-2023 Alexander Todorov <[email protected]>
1+
# Copyright (c) 2022-2024 Alexander Todorov <[email protected]>
22
#
33
# Licensed under the GPL 3.0: https://www.gnu.org/licenses/gpl-3.0.txt
44
#
@@ -37,7 +37,8 @@ def _fixture_setup(self):
3737
self.execution_1.run.save()
3838

3939
self.component = ComponentFactory(
40-
name="OpenProject integration", product=self.execution_1.run.plan.product
40+
name="OpenProject integration",
41+
product=self.execution_1.build.version.product,
4142
)
4243
self.execution_1.case.add_component(self.component)
4344

@@ -120,7 +121,7 @@ def test_report_issue_from_test_execution_1click_works(self):
120121
for expected_string in [
121122
f"Filed from execution {self.execution_1.get_full_url()}",
122123
"Reporter",
123-
self.execution_1.run.plan.product.name,
124+
self.execution_1.build.version.product.name,
124125
self.component.name,
125126
"Steps to reproduce",
126127
self.execution_1.case.text,
@@ -177,11 +178,12 @@ def _fixture_setup(self):
177178
self.execution_1.run.save()
178179

179180
# 'kiwitcms-bot' user is authorized only for this project
180-
self.execution_1.run.plan.product.name = "Demo project"
181-
self.execution_1.run.plan.product.save()
181+
self.execution_1.build.version.product.name = "Demo project"
182+
self.execution_1.build.version.product.save()
182183

183184
self.component = ComponentFactory(
184-
name="OpenProject integration", product=self.execution_1.run.plan.product
185+
name="OpenProject integration",
186+
product=self.execution_1.build.version.product,
185187
)
186188
self.execution_1.case.add_component(self.component)
187189

@@ -263,7 +265,7 @@ def test_report_issue_from_test_execution_1click_works(self):
263265
for expected_string in [
264266
f"Filed from execution {self.execution_1.get_full_url()}",
265267
"Reporter",
266-
self.execution_1.run.plan.product.name,
268+
self.execution_1.build.version.product.name,
267269
self.component.name,
268270
"Steps to reproduce",
269271
self.execution_1.case.text,

0 commit comments

Comments
 (0)