Add tests for split_cl.py

This CL:
- Adds tests for split_cl.UploadCl()
- Splits out logic checking bug links so that it can be tested

Bug:None

Change-Id: I3c08b129e0cfda67a3d93a2e01acef86d33e92b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4743773
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
diff --git a/split_cl.py b/split_cl.py
index 2888a7c..5587954 100644
--- a/split_cl.py
+++ b/split_cl.py
@@ -142,7 +142,7 @@
   # Upload a CL.
   upload_args = ['-f']
   if reviewers:
-    upload_args.extend(['-r', ','.join(reviewers)])
+    upload_args.extend(['-r', ','.join(sorted(reviewers))])
   if cq_dry_run:
     upload_args.append('--cq-dry-run')
   if not comment:
@@ -262,16 +262,7 @@
     assert refactor_branch_upstream, \
         "Branch %s must have an upstream." % refactor_branch
 
-    # Verify that the description contains a bug link. Examples:
-    #   Bug: 123
-    #   Bug: chromium:456
-    bug_pattern = re.compile(r"^Bug:\s*(?:[a-zA-Z]+:)?[0-9]+", re.MULTILINE)
-    matches = re.findall(bug_pattern, description)
-    answer = 'y'
-    if not matches:
-      answer = gclient_utils.AskForData(
-          'Description does not include a bug link. Proceed? (y/n):')
-    if answer.lower() != 'y':
+    if not CheckDescriptionBugLink(description):
       return 0
 
     files_split_by_reviewers = SelectReviewersForFiles(cl, author, files,
@@ -327,6 +318,24 @@
   return 0
 
 
+def CheckDescriptionBugLink(description):
+  """Verifies that the description contains a bug link.
+
+  Examples:
+      Bug: 123
+      Bug: chromium:456
+
+  Prompts user if the description does not contain a bug link.
+  """
+  bug_pattern = re.compile(r"^Bug:\s*(?:[a-zA-Z]+:)?[0-9]+", re.MULTILINE)
+  matches = re.findall(bug_pattern, description)
+  answer = 'y'
+  if not matches:
+    answer = gclient_utils.AskForData(
+        'Description does not include a bug link. Proceed? (y/n):')
+  return answer.lower() == 'y'
+
+
 def SelectReviewersForFiles(cl, author, files, max_depth):
   """Selects reviewers for passed-in files