Skip to content

Commit

Permalink
Add LR to TE after creating bug in Bugzilla via 1-click. Refs #479
Browse files Browse the repository at this point in the history
NOTE: the FE still needs to refresh the UI once the 'Report' button
is clicked which will be implemented together with TR page UI
redesign by @asankov.
  • Loading branch information
atodorov committed May 18, 2020
1 parent a10c83c commit 341bd08
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tcms/issuetracker/bugzilla_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from django.conf import settings

from tcms.core.contrib.linkreference.models import LinkReference
from tcms.issuetracker import base


Expand Down Expand Up @@ -96,7 +97,14 @@ def report_issue_from_testexecution(self, execution, user):
args['comment'] = self._report_comment(execution)

try:
return self.one_click_report(execution, user, args)
new_bug_url = self.one_click_report(execution, user, args)
# and also add a link reference that will be shown in the UI
LinkReference.objects.get_or_create(
execution=execution,
url=new_bug_url,
is_defect=True,
)
return new_bug_url
except Fault:
pass

Expand Down
8 changes: 8 additions & 0 deletions tcms/issuetracker/tests/test_bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest
from urllib.parse import urlencode

from tcms.core.contrib.linkreference.models import LinkReference
from tcms.issuetracker.types import Bugzilla
from tcms.management.models import Version
from tcms.rpc.tests.utils import APITestCase
Expand Down Expand Up @@ -152,3 +153,10 @@ def test_report_issue_from_test_execution_1click_works(self):
component.name,
test_case.text]:
self.assertIn(expected_string, last_comment['text'])

# verify that LR has been added to TE
self.assertTrue(LinkReference.objects.filter(
execution=execution2,
url=result['response'],
is_defect=True,
).exists())

0 comments on commit 341bd08

Please sign in to comment.