Title: [294893] trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy
Revision
294893
Author
[email protected]
Date
2022-05-26 13:18:36 -0700 (Thu, 26 May 2022)

Log Message

[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

Modified Paths

Diff

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py (294892 => 294893)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py	2022-05-26 20:06:56 UTC (rev 294892)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py	2022-05-26 20:18:36 UTC (rev 294893)
@@ -118,7 +118,7 @@
 
         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,

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py (294892 => 294893)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py	2022-05-26 20:06:56 UTC (rev 294892)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py	2022-05-26 20:18:36 UTC (rev 294893)
@@ -125,8 +125,7 @@
         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,
@@ -177,6 +176,49 @@
         )
         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(), '')
+
     def test_to_branch_name(self):
         self.assertEqual(program.Branch.to_branch_name('something with spaces'), 'something-with-spaces')
         self.assertEqual(program.Branch.to_branch_name('[EWS] bug description'), 'EWS-bug-description')
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to