[Patchew-devel] [PATCH] rest: Add endpoint from update-project-head

Shubham Jain shubhamjain7495 at gmail.com
Wed May 30 07:21:36 UTC 2018


So I tried doing something like this. But I'm still not sure how to add the
the series to the git and which series should be added.
def test_update_project_head(self):
        resp = self.apply_and_retrieve('some.mbox.gz',
                                       self.p.id, 'some_message_id')
        self.api_client.login(username=self.user, password=self.password)

        resp_before = self.api_client.get(self.PROJECT_BASE + "series/"+
"some_message_id/")
        data = {
                "message_ids": [...],
                "old_head": "..",
                "new_head": "..."
                }
        resp = self.api_client.post(self.PROJECT_BASE +
"update_project_head/", data=data, content_type='application/json')
        resp_after = self.api_client.get(self.PROJECT_BASE + "series/"+
"some_message_id")
        self.assertEquals(resp_before.data['is_merged'], False)
        self.assertEquals(resp.status_code, 200)
        self.assertEquals(resp.data['count'],1)
        self.assertEquals(resp.data['new_head'],"..")
        self.assertEquals(resp_after.data['is_merged'], True)

On Tue, May 29, 2018 at 5:44 PM Paolo Bonzini <pbonzini at redhat.com> wrote:

> On 29/05/2018 14:07, Shubham Jain wrote:
> > Two questions regarding the patch. I couldn't find the test case in the
> > legacy update-head and hence couldn't think of how to test this.
>
> You're right, the only test case for update-head uses patchew-cli to
> invoke it.  It's in commit ea3c69962a38c77c43672190dda314c56aaa983a.
>
> tests/test_testing.py has some example of manipulating a git repository
> from the tests.  See for example add_file_and_commit and
> test_tester_project.
>
> Thanks,
>
> Paolo
>
> > Second, Is the data required in the POST correct? I mean, is there any
> > other way we can feed the message ids?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/patchew-devel/attachments/20180530/89fdbdf9/attachment.htm>


More information about the Patchew-devel mailing list