[Patchew-devel] [PATCH] rest: add api/v1/messages endpoint (POST support)
Shubham Jain
shubhamjain7495 at gmail.com
Tue May 15 10:30:43 UTC 2018
Apparently calling only save in loop is leading to update. So overrode the
create() and it works.
+ def test_create_message_without_project_pk(self):
> + dp = self.get_data_path("0024-multiple-project-patch.json.gz")
> + with open(dp, "r") as f:
> + data = f.read()
> + self.api_client.login(username=self.user, password=self.password)
> + resp = self.api_client.post(self.REST_BASE + "messages/", data,
> content_type='application/json')
> + self.assertEqual(resp.status_code, 201)
> + self.assertEqual(resp.data, "Sucess")
> + resp_get = self.api_client.get(self.PROJECT_BASE + "messages/
> 20180223132311.26555-2-marcandre.lureau at redhat.com/")
> + self.assertEqual(resp_get.status_code, 200)
> + self.assertEqual(resp_get.data['subject'], "[Qemu-devel] [PATCH
> 1/7] SecurityPkg/Tcg2Pei: drop Tcg2PhysicalPresenceLib dependency")
> + resp_get2 = self.api_client.get(self.PROJECT_BASE_2 + "messages/
> 20180223132311.26555-2-marcandre.lureau at redhat.com/")
> +
> + def test_create_text_message_without_project_pk(self):
> + dp = self.get_data_path("0023-multiple-project-patch.mbox.gz")
> + with open(dp, "r") as f:
> + data = f.read()
> + self.api_client.login(username=self.user, password=self.password)
> + resp = self.api_client.post(self.REST_BASE + "messages/", data,
> content_type='message/rfc822')
> + self.assertEqual(resp.status_code, 201)
> + self.assertEqual(resp.data, "Sucess")
> + resp_get = self.api_client.get(self.PROJECT_BASE + "messages/
> 20180223132311.26555-2-marcandre.lureau at redhat.com/")
> + self.assertEqual(resp_get.status_code, 200)
> + self.assertEqual(resp_get.data['subject'], "[Qemu-devel] [PATCH
> 1/7] SecurityPkg/Tcg2Pei: drop Tcg2PhysicalPresenceLib dependency")
> + resp_get2 = self.api_client.get(self.PROJECT_BASE_2 + "messages/
> 20180223132311.26555-2-marcandre.lureau at redhat.com/")
> +
> def test_message(self):
> series = self.apply_and_retrieve('0001-simple-patch.mbox.gz',
> self.p.id, '
> 20160628014747.20971-1-famz at redhat.com')
> @@ -346,5 +374,26 @@ class RestTest(PatchewTestCase):
> resp = self.api_client.get(self.REST_BASE + 'schema/')
> self.assertEqual(resp.status_code, 200)
>
> + # def test_create_message_without_project_pk(self):
> + # dp = self.get_data_path("multiple-project-patch.json.gz")
> + # with open(dp, "r") as f:
> + # data = f.read()
> + # self.api_client.login(username=self.user,
> password=self.password)
> + # resp = self.api_client.post(self.REST_BASE + "messages/", data,
> content_type='application/json')
> + # print(resp.data)
> + # self.assertEqual(resp.status_code, 201)
> + # resp_get = self.api_client.get(self.PROJECT_BASE + "messages/
> 20180223132311.26555-2-marcandre.lureau at redhat.com/")
> + # self.assertEqual(resp_get.status_code, 200)
> + # self.assertEqual(resp.data['subject'], "[Qemu-devel] [PATCH
> 1/7] SecurityPkg/Tcg2Pei: drop Tcg2PhysicalPresenceLib dependency")
> +
> + # def test_create_text_message_without_project_pk(self):
> + # ? print(resp.data)
> +
> + # self.assertEqual(resp.status_code, 201)
> + # resp_get = self.api_client.get(self.PROJECT_BASE + "messages/
> 20180223132311.26555-2-marcandre.lureau at redhat.com/")
> + # self.assertEqual(resp_get.status_code, 200)
> + # self.assertEqual(resp.data['subject'], "[Qemu-devel] [PATCH
> 1/7] SecurityPkg/Tcg2Pei: drop Tcg2PhysicalPresenceLib dependency")
> +
> +
>
Ignore this, will correct it.
> if __name__ == '__main__':
> main()
> --
> 2.14.3 (Apple Git-98)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/patchew-devel/attachments/20180515/dc76a740/attachment.htm>
More information about the Patchew-devel
mailing list