Gerrit git cl upload: abort early if change is submitted or abandoned.

BUG=689652
R=agable@chromium.org,martiniss@chromium.org

Change-Id: Ib9f5b08f5b31a1519a5f5916042885967a263d88
Reviewed-on: https://chromium-review.googlesource.com/443325
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index a2e3733..3d97726 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1152,9 +1152,20 @@
            'refs/remotes/origin/master'],),
          'fake_ancestor_sha'),
         # Calls to verify branch point is ancestor
-      ] + (cls._gerrit_ensure_auth_calls(issue=issue) +
-           cls._git_sanity_checks('fake_ancestor_sha', 'master',
-                                  get_remote_branch=False)) + [
+      ] + cls._gerrit_ensure_auth_calls(issue=issue) + ([
+        (('GetChangeDetail', 'chromium-review.googlesource.com',
+          '123456', ['CURRENT_REVISION', 'CURRENT_COMMIT']),
+         {
+           'change_id': '123456789',
+           'current_revision': 'sha1_of_current_revision',
+           'revisions': { 'sha1_of_current_revision': {
+             'commit': {'message': fetched_description},
+           }},
+           'status': 'NEW',
+         }),
+      ] if issue else [
+      ]) + cls._git_sanity_checks('fake_ancestor_sha', 'master',
+                                  get_remote_branch=False) + [
         ((['git', 'rev-parse', '--show-cdup'],), ''),
         ((['git', 'rev-parse', 'HEAD'],), '12345'),
 
@@ -1164,15 +1175,6 @@
          'M\t.gitignore\n'),
         ((['git', 'config', 'branch.master.gerritpatchset'],), CERR1),
       ] + ([
-        (('GetChangeDetail', 'chromium-review.googlesource.com',
-          '123456', ['CURRENT_REVISION', 'CURRENT_COMMIT']),
-         {
-           'change_id': '123456789',
-           'current_revision': 'sha1_of_current_revision',
-           'revisions': { 'sha1_of_current_revision': {
-             'commit': {'message': fetched_description},
-           }},
-         }),
       ] if issue else [
         ((['git',
            'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],),