<div dir="ltr">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. <div><div>def test_update_project_head(self):</div><div>        resp = self.apply_and_retrieve('some.mbox.gz',</div><div>                                       <a href="http://self.p.id">self.p.id</a>, 'some_message_id')</div><div>        self.api_client.login(username=self.user, password=self.password)        </div><div>        resp_before = self.api_client.get(self.PROJECT_BASE + "series/"+ "some_message_id/")</div><div>        data = {</div><div>                "message_ids": [...],</div><div>                "old_head": "..",</div><div>                "new_head": "..."</div><div>                }</div><div>        resp = self.api_client.post(self.PROJECT_BASE + "update_project_head/", data=data, content_type='application/json')</div><div>        resp_after = self.api_client.get(self.PROJECT_BASE + "series/"+ "some_message_id")</div><div>        self.assertEquals(resp_before.data['is_merged'], False)</div><div>        self.assertEquals(resp.status_code, 200)</div><div>        self.assertEquals(resp.data['count'],1)</div><div>        self.assertEquals(resp.data['new_head'],"..")</div><div>        self.assertEquals(resp_after.data['is_merged'], True)</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 29, 2018 at 5:44 PM Paolo Bonzini <<a href="mailto:pbonzini@redhat.com">pbonzini@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 29/05/2018 14:07, Shubham Jain wrote:<br>
> Two questions regarding the patch. I couldn't find the test case in the<br>
> legacy update-head and hence couldn't think of how to test this.<br>
<br>
You're right, the only test case for update-head uses patchew-cli to<br>
invoke it.  It's in commit ea3c69962a38c77c43672190dda314c56aaa983a.<br>
<br>
tests/test_testing.py has some example of manipulating a git repository<br>
from the tests.  See for example add_file_and_commit and<br>
test_tester_project.<br>
<br>
Thanks,<br>
<br>
Paolo<br>
<br>
> Second, Is the data required in the POST correct? I mean, is there any<br>
> other way we can feed the message ids?<br>
<br>
</blockquote></div>