Title: [289948] trunk/Tools
Revision
289948
Author
[email protected]
Date
2022-02-16 13:05:40 -0800 (Wed, 16 Feb 2022)

Log Message

[EWS] Add tests for GitHub class
https://bugs.webkit.org/show_bug.cgi?id=236649
<rdar://problem/88966033>

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps_unittest.py:
(TestGitHub):
(TestGitHub.test_pr_url):
(TestGitHub.test_pr_url_with_repository):
(TestGitHub.test_pr_url_with_invalid_repository):
(TestGitHub.test_commit_url):
(TestGitHub.test_commit_url_with_repository):
(TestGitHub.test_commit_url_with_invalid_repository):

Canonical link: https://commits.webkit.org/247350@main

Modified Paths

Diff

Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (289947 => 289948)


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-02-16 20:52:57 UTC (rev 289947)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-02-16 21:05:40 UTC (rev 289948)
@@ -46,7 +46,7 @@
                    CleanBuild, CleanUpGitIndexLock, CleanGitRepo, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutChange,
                    CompileWebKit, CompileWebKitWithoutChange, ConfigureBuild, ConfigureBuild, Contributors, CreateLocalGITCommit,
                    DownloadBuiltProduct, DownloadBuiltProductFromMaster, EWS_BUILD_HOSTNAME, ExtractBuiltProduct, ExtractTestResults,
-                   FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitResetHard,
+                   FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitHub, GitResetHard,
                    InstallBuiltProduct, InstallGtkDependencies, InstallWpeDependencies,
                    KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo, ReRunAPITests, ReRunWebKitPerlTests,
                    ReRunWebKitTests, RevertPullRequestChanges, RunAPITests, RunAPITestsWithoutPatch, RunBindingsTests, RunBuildWebKitOrgUnitTests,
@@ -228,6 +228,44 @@
     return behavior
 
 
+class TestGitHub(unittest.TestCase):
+    def test_pr_url(self):
+        self.assertEqual(
+            GitHub.pr_url(1234),
+            'https://github.com/WebKit/WebKit/pull/1234',
+        )
+
+    def test_pr_url_with_repository(self):
+        self.assertEqual(
+            GitHub.pr_url(1234, 'https://github.com/WebKit/WebKit'),
+            'https://github.com/WebKit/WebKit/pull/1234',
+        )
+
+    def test_pr_url_with_invalid_repository(self):
+        self.assertEqual(
+            GitHub.pr_url(1234, 'https://github.example.com/WebKit/WebKit'),
+            '',
+        )
+
+    def test_commit_url(self):
+        self.assertEqual(
+            GitHub.commit_url('936e3f7cab4a826519121a75bf4481fe56e727e2'),
+            'https://github.com/WebKit/WebKit/commit/936e3f7cab4a826519121a75bf4481fe56e727e2',
+        )
+
+    def test_commit_url_with_repository(self):
+        self.assertEqual(
+            GitHub.commit_url('936e3f7cab4a826519121a75bf4481fe56e727e2', 'https://github.com/WebKit/WebKit'),
+            'https://github.com/WebKit/WebKit/commit/936e3f7cab4a826519121a75bf4481fe56e727e2',
+        )
+
+    def test_commit_url_with_invalid_repository(self):
+        self.assertEqual(
+            GitHub.commit_url('936e3f7cab4a826519121a75bf4481fe56e727e2', 'https://github.example.com/WebKit/WebKit'),
+            '',
+        )
+
+
 class TestStepNameShouldBeValidIdentifier(BuildStepMixinAdditions, unittest.TestCase):
     def test_step_names_are_valid(self):
         import steps

Modified: trunk/Tools/ChangeLog (289947 => 289948)


--- trunk/Tools/ChangeLog	2022-02-16 20:52:57 UTC (rev 289947)
+++ trunk/Tools/ChangeLog	2022-02-16 21:05:40 UTC (rev 289948)
@@ -1,3 +1,20 @@
+2022-02-15  Jonathan Bedard  <[email protected]>
+
+        [EWS] Add tests for GitHub class
+        https://bugs.webkit.org/show_bug.cgi?id=236649
+        <rdar://problem/88966033>
+
+        Reviewed by Aakash Jain.
+
+        * CISupport/ews-build/steps_unittest.py:
+        (TestGitHub):
+        (TestGitHub.test_pr_url):
+        (TestGitHub.test_pr_url_with_repository):
+        (TestGitHub.test_pr_url_with_invalid_repository):
+        (TestGitHub.test_commit_url):
+        (TestGitHub.test_commit_url_with_repository):
+        (TestGitHub.test_commit_url_with_invalid_repository):
+
 2022-02-16  Carlos Alberto Lopez Perez  <[email protected]>
 
         [EWS][GTK] Send only one e-mail with all the list of flakies
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to