Skip to content
Permalink
Browse files
[git-webkit] Support radar when auto-filing bug
https://bugs.webkit.org/show_bug.cgi?id=240969
<rdar://problem/93989777>

Reviewed by Dewei Zhu.

* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py:
(Branch.main): Handle case where tracker does not have defined credentials.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py:
(TestBranch.test_create_bug): Added.

Canonical link: https://commits.webkit.org/251016@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed May 26, 2022
1 parent 53361d1 commit 8fd6de79337b8f59cb5e822a7302549928877e77
Showing 2 changed files with 45 additions and 3 deletions.
@@ -118,7 +118,7 @@ def main(cls, args, repository, why=None, redact=False, **kwargs):

if not issue and Tracker.instance():
if ' ' in args.issue:
if getattr(Tracker.instance(), 'credentials'):
if getattr(Tracker.instance(), 'credentials', None):
Tracker.instance().credentials(required=True, validate=True)
issue = Tracker.instance().create(
title=args.issue,
@@ -125,8 +125,7 @@ def test_invalid_branch(self):
self.assertEqual(captured.stderr.getvalue(), "'eng/reject_underscores' is an invalid branch name, cannot create it\n")

def test_create_bug(self):
self.maxDiff = None
with MockTerminal.input('2'), OutputCapture(level=logging.INFO) as captured, mocks.local.Git(self.path), bmocks.Bugzilla(
with OutputCapture(level=logging.INFO) as captured, mocks.local.Git(self.path), bmocks.Bugzilla(
self.BUGZILLA.split('://')[-1],
issues=bmocks.ISSUES,
projects=bmocks.PROJECTS,
@@ -173,6 +172,49 @@ def test_create_bug(self):
:
Created 'https://bugs.example.com/show_bug.cgi?id=4 [Area] New Issue'
Created the local development branch 'eng/Area-New-Issue'
''',
)
self.assertEqual(captured.stderr.getvalue(), '')

def test_create_radar(self):
with OutputCapture(level=logging.INFO) as captured, mocks.local.Git(self.path), Environment(RADAR_USERNAME='tcontributor'), bmocks.Radar(
issues=bmocks.ISSUES,
projects=bmocks.PROJECTS,
), patch('webkitbugspy.Tracker._trackers', [radar.Tracker(project='WebKit')]), mocks.local.Svn(), MockTime, wkmocks.Terminal.input(
'[Area] New Issue', 'Issue created via command line prompts.',
'1', '2',
):
self.assertEqual(0, program.main(
args=('branch',),
path=self.path,
))
self.assertEqual(local.Git(self.path).branch, 'eng/Area-New-Issue')

issue = radar.Tracker(project='WebKit').issue(4)
self.assertEqual(issue.title, '[Area] New Issue')
self.assertEqual(issue.description, 'Issue created via command line prompts.')
self.assertEqual(issue.project, 'WebKit')
self.assertEqual(issue.component, 'SVG')
self.assertEqual(issue.version, 'Safari 15')

self.assertEqual(
captured.stdout.getvalue(),
'''Enter issue URL or title of new issue:
Issue description:
What component in 'WebKit' should the bug be associated with?:
1) SVG
2) Scrolling
3) Tables
4) Text
:
What version of 'WebKit SVG' should the bug be associated with?:
1) Other
2) Safari 15
3) Safari Technology Preview
4) WebKit Local Build
:
Created '<rdar://4> [Area] New Issue'
Created the local development branch 'eng/Area-New-Issue'
''',
)
self.assertEqual(captured.stderr.getvalue(), '')

0 comments on commit 8fd6de7

Please sign in to comment.