From fbc0be01abaa49cc6324b3a32e9be19115bd1f0f Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <patrick@puiterwijk.org>
Date: Sep 24 2018 07:59:28 +0000
Subject: [PATCH 1/3] Update tests for reversed PR flag ordering


Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>

---

diff --git a/tests/test_pagure_flask_api_pr_flag.py b/tests/test_pagure_flask_api_pr_flag.py
index 1bf40af..b220ce0 100644
--- a/tests/test_pagure_flask_api_pr_flag.py
+++ b/tests/test_pagure_flask_api_pr_flag.py
@@ -484,10 +484,10 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests):
         request = pagure.lib.search_pull_requests(
             self.session, project_id=1, requestid=1)
         self.assertEqual(len(request.flags), 2)
-        self.assertEqual(request.flags[0].comment, 'Tests passed')
-        self.assertEqual(request.flags[0].percent, 100)
-        self.assertEqual(request.flags[1].comment, 'Tests running again')
-        self.assertEqual(request.flags[1].percent, None)
+        self.assertEqual(request.flags[0].comment, 'Tests running again')
+        self.assertEqual(request.flags[0].percent, None)
+        self.assertEqual(request.flags[1].comment, 'Tests passed')
+        self.assertEqual(request.flags[1].percent, 100)
 
     @patch.dict('pagure.config.config',
                 {

From 3a871a0d114bcb3d5bd92ca4291b84ed4a4b538a Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <patrick@puiterwijk.org>
Date: Sep 24 2018 07:59:28 +0000
Subject: [PATCH 2/3] Fix black code style


Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>

---

diff --git a/pagure/internal/__init__.py b/pagure/internal/__init__.py
index 23b3142..28f5c7c 100644
--- a/pagure/internal/__init__.py
+++ b/pagure/internal/__init__.py
@@ -226,18 +226,18 @@ def mergeable_request_pull():
             )
         except pygit2.GitError as err:
             response = flask.jsonify(
-                {"code": "CONFLICTS", "message": "%s" % err})
+                {"code": "CONFLICTS", "message": "%s" % err}
+            )
             response.status_code = 409
             return response
         except pagure.exceptions.PagureException as err:
             response = flask.jsonify(
-                {"code": "CONFLICTS", "message": "%s" % err})
+                {"code": "CONFLICTS", "message": "%s" % err}
+            )
             response.status_code = 500
             return response
 
-    return flask.jsonify(
-        pagure.utils.get_merge_options(request, merge_status)
-    )
+    return flask.jsonify(pagure.utils.get_merge_options(request, merge_status))
 
 
 @PV.route("/pull-request/ready", methods=["POST"])
@@ -296,17 +296,10 @@ def get_pull_request_ready_branch():
             response.status_code = 400
             return response
     task = pagure.lib.tasks.pull_request_ready_branch.delay(
-        namespace=args_namespace,
-        name=args_reponame,
-        user=args_user,
+        namespace=args_namespace, name=args_reponame, user=args_user
     )
 
-    return flask.jsonify(
-        {
-            "code": "OK",
-            "task": task.id,
-        }
-    )
+    return flask.jsonify({"code": "OK", "task": task.id})
 
 
 @PV.route("/<repo>/issue/template", methods=["POST"])
diff --git a/pagure/lib/model.py b/pagure/lib/model.py
index 5aa0093..0759b96 100644
--- a/pagure/lib/model.py
+++ b/pagure/lib/model.py
@@ -2237,7 +2237,7 @@ class PullRequestFlag(BASE):
         backref=backref(
             "flags",
             order_by=str("(pull_request_flags.c.date_created).desc()"),
-            cascade="delete, delete-orphan"
+            cascade="delete, delete-orphan",
         ),
         foreign_keys=[pull_request_uid],
         remote_side=[PullRequest.uid],
diff --git a/pagure/lib/tasks_services.py b/pagure/lib/tasks_services.py
index cafcc6a..3713c35 100644
--- a/pagure/lib/tasks_services.py
+++ b/pagure/lib/tasks_services.py
@@ -383,7 +383,8 @@ def load_json_commits_to_db(
 @conn.task(queue=pagure_config.get("CI_CELERY_QUEUE", None), bind=True)
 @pagure_task
 def trigger_ci_build(
-        self, session, cause, branch, ci_type, project_name=None, pr_uid=None):
+    self, session, cause, branch, ci_type, project_name=None, pr_uid=None
+):
 
     """ Triggers a new run of the CI system on the specified pull-request.
 
diff --git a/pagure/utils.py b/pagure/utils.py
index 74e84e5..25165ca 100644
--- a/pagure/utils.py
+++ b/pagure/utils.py
@@ -526,12 +526,13 @@ def get_merge_options(request, merge_status):
             "code": "CONFLICTS",
             "short_code": "Conflicts",
             "message": "The pull-request must be rebased before merging",
-        }
+        },
     }
 
     if merge_status == "MERGE":
         if request.project.settings.get(
-                "disable_non_fast-forward_merges", False):
+            "disable_non_fast-forward_merges", False
+        ):
             merge_status += "-non-ff-bad"
         else:
             merge_status += "-non-ff-ok"

From 6264c4d02d8e94db8dbba1e42b291453d241f4e2 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <patrick@puiterwijk.org>
Date: Sep 24 2018 07:59:28 +0000
Subject: [PATCH 3/3] Ignore runtests.py test results


Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>

---

diff --git a/.gitignore b/.gitignore
index d99a465..3737ffc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@ pagureenv-*
 worker.log
 
 _build/
+results/
 
 # Just a local folder I use for testing
 clones/

