[Patchew-devel] [PATCH] tests: check config PUT for non-admin maintainers

Paolo Bonzini posted 1 patch 2 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew-ci tags/patchew/20210806165844.140447-1-pbonzini@redhat.com
tests/test_rest.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
[Patchew-devel] [PATCH] tests: check config PUT for non-admin maintainers
Posted by Paolo Bonzini 2 years, 8 months ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/test_rest.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/test_rest.py b/tests/test_rest.py
index e82d8fa..cceda69 100755
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -128,6 +128,21 @@ class RestTest(PatchewTestCase):
         self.assertEquals(resp.status_code, 200)
         self.assertEquals(resp.data["git"]["push_to"], "/tmp/bbb")
 
+    def test_project_maintainer_config_put(self):
+        test = self.create_user(username="test", password="userpass")
+        self.api_client.login(username="test", password="userpass")
+        self.p.maintainers.set([test])
+
+        new_config = {"git": {"push_to": "/tmp/bbb"}}
+        resp = self.api_client.put(
+            self.PROJECT_BASE + "config/", new_config, format="json"
+        )
+        self.assertEquals(resp.status_code, 200)
+        self.assertEquals(resp.data["git"]["push_to"], "/tmp/bbb")
+        resp = self.api_client.get(self.PROJECT_BASE + "config/")
+        self.assertEquals(resp.status_code, 200)
+        self.assertEquals(resp.data["git"]["push_to"], "/tmp/bbb")
+
     def test_update_project_head(self):
         resp = self.apply_and_retrieve(
             "0001-simple-patch.mbox.gz",
-- 
2.31.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel

[Patchew-devel] [PATCH] tweak sorting to handle last_reply_date better
Posted by Paolo Bonzini 2 years, 8 months ago
Postgres treats NULL as larger than anything else, so the REST series view starts
with all messages that never had a reply.  Sort by id instead for stability and
to get more obvious results.

In the web view, place non-replied messages last and sort them by descending date.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 api/rest.py  | 2 +-
 www/views.py | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/api/rest.py b/api/rest.py
index de02857..b723997 100644
--- a/api/rest.py
+++ b/api/rest.py
@@ -540,7 +540,7 @@ class PatchewSearchFilter(filters.BaseFilterBackend):
 
 class SeriesViewSet(BaseMessageViewSet):
     serializer_class = SeriesSerializer
-    queryset = Message.objects.filter(topic__isnull=False).order_by("-last_reply_date")
+    queryset = Message.objects.filter(topic__isnull=False).order_by("-id")
     filter_backends = (PatchewSearchFilter,)
     search_fields = (SEARCH_PARAM,)
 
diff --git a/www/views.py b/www/views.py
index e20aa91..d8c40af 100644
--- a/www/views.py
+++ b/www/views.py
@@ -176,13 +176,11 @@ def prepare_navigate_list(cur, *path):
 def render_series_list_page(request, query, search=None, project=None, keywords=[]):
     sort = request.GET.get("sort")
     if sort == "replied":
-        sortfield = "-last_reply_date"
+        query = query.order_by(F('last_reply_date').desc(nulls_last=True), '-date')
         order_by_reply = True
     else:
-        sortfield = "-date"
+        query = query.order_by('-date')
         order_by_reply = False
-    if sortfield:
-        query = query.order_by(sortfield)
     query = query.prefetch_related("topic")
     cur_page = get_page_from_request(request)
     start = (cur_page - 1) * PAGE_SIZE
-- 
2.31.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel

[Patchew-devel] [PATCH] update pip inside virtual environments
Posted by Paolo Bonzini 2 years, 8 months ago
Old versions of pip are not able to install psycopg2-binary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/dockerfiles/server.docker | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/dockerfiles/server.docker b/scripts/dockerfiles/server.docker
index ea02434..4b2a4ff 100644
--- a/scripts/dockerfiles/server.docker
+++ b/scripts/dockerfiles/server.docker
@@ -8,6 +8,7 @@ RUN /bin/bash -c "mkdir -p /opt/patchew && \
     cd /opt/patchew && \
     python3 -m venv ./venv && \
     . venv/bin/activate && \
+    pip3 install --upgrade pip && \
     pip3 install -r /tmp/requirements.txt"
 COPY . /tmp/patchew/
 # Be careful not to overwrite the venv we've just initialized
-- 
2.31.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel

[Patchew-devel] [PATCH] playbooks: update name of docker RPM
Posted by Paolo Bonzini 2 years, 8 months ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/playbooks/tasks/docker-deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/playbooks/tasks/docker-deploy.yml b/scripts/playbooks/tasks/docker-deploy.yml
index a3a1a0a..2cd2f32 100644
--- a/scripts/playbooks/tasks/docker-deploy.yml
+++ b/scripts/playbooks/tasks/docker-deploy.yml
@@ -7,7 +7,7 @@
     name: python-pip
 - name: Install docker
   package:
-    name: docker-ce
+    name: docker
 - name: Start docker daemon
   service:
     name: docker
-- 
2.31.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel

[Patchew-devel] [PATCH] tests: set default branch name
Posted by Paolo Bonzini 2 years, 8 months ago
git allows overriding the default branch name, but the tests configure the
project in Patchew so that the default branch for the applier is "master".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/patchewtest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/patchewtest.py b/tests/patchewtest.py
index 33923d1..cc6f197 100644
--- a/tests/patchewtest.py
+++ b/tests/patchewtest.py
@@ -177,7 +177,7 @@ class PatchewTestCase(dj_test.LiveServerTestCase):
     def create_git_repo(self, name="test-repo"):
         repo = os.path.join(self.get_tmpdir(), name)
         os.mkdir(repo)
-        subprocess.check_output(["git", "init"], cwd=repo)
+        subprocess.check_output(["git", "init", "-bmaster"], cwd=repo)
         subprocess.check_output(["git", "config", "user.name", "Patchew Test"], cwd=repo)
         subprocess.check_output(["git", "config", "user.email", "test@patchew.org"], cwd=repo)
         subprocess.check_output(["touch", "foo", "bar"], cwd=repo)
-- 
2.31.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel