From 8534a03570b2c85f5c43cac34b55c5da9b072e8e Mon Sep 17 00:00:00 2001 From: ivan-zhu Date: Wed, 22 May 2013 14:02:07 +0800 Subject: add xml api sample tests to os-tenant-network Change-Id: Ib79defe49c82a175cb8605aa3a65ccd2c48d68f7 --- doc/api_samples/os-tenant-networks/networks-list-res.xml | 13 +++++++++++++ doc/api_samples/os-tenant-networks/networks-post-req.xml | 7 +++++++ doc/api_samples/os-tenant-networks/networks-post-res.xml | 6 ++++++ .../os-tenant-networks/networks-list-res.xml.tpl | 13 +++++++++++++ .../os-tenant-networks/networks-post-req.xml.tpl | 7 +++++++ .../os-tenant-networks/networks-post-res.xml.tpl | 5 +++++ nova/tests/integrated/test_api_samples.py | 11 +++++++++++ 7 files changed, 62 insertions(+) create mode 100644 doc/api_samples/os-tenant-networks/networks-list-res.xml create mode 100644 doc/api_samples/os-tenant-networks/networks-post-req.xml create mode 100644 doc/api_samples/os-tenant-networks/networks-post-res.xml create mode 100644 nova/tests/integrated/api_samples/os-tenant-networks/networks-list-res.xml.tpl create mode 100644 nova/tests/integrated/api_samples/os-tenant-networks/networks-post-req.xml.tpl create mode 100644 nova/tests/integrated/api_samples/os-tenant-networks/networks-post-res.xml.tpl diff --git a/doc/api_samples/os-tenant-networks/networks-list-res.xml b/doc/api_samples/os-tenant-networks/networks-list-res.xml new file mode 100644 index 000000000..6aaeec85b --- /dev/null +++ b/doc/api_samples/os-tenant-networks/networks-list-res.xml @@ -0,0 +1,13 @@ + + + + 10.0.0.0/29 + cf3fb0f1-9967-4dac-8284-2d103e904099 + + + + 10.0.0.8/29 + 434385bc-a7ac-4778-b295-56f8134fddbc + + + \ No newline at end of file diff --git a/doc/api_samples/os-tenant-networks/networks-post-req.xml b/doc/api_samples/os-tenant-networks/networks-post-req.xml new file mode 100644 index 000000000..f4c06aa9d --- /dev/null +++ b/doc/api_samples/os-tenant-networks/networks-post-req.xml @@ -0,0 +1,7 @@ + + + 172.0.0.0/24 + 1 + 1 + 255 + \ No newline at end of file diff --git a/doc/api_samples/os-tenant-networks/networks-post-res.xml b/doc/api_samples/os-tenant-networks/networks-post-res.xml new file mode 100644 index 000000000..7bbc6a4b6 --- /dev/null +++ b/doc/api_samples/os-tenant-networks/networks-post-res.xml @@ -0,0 +1,6 @@ + + + 172.0.0.0/24 + 9ac30188-57d8-4349-94d1-dbad63b20e4d + + \ No newline at end of file diff --git a/nova/tests/integrated/api_samples/os-tenant-networks/networks-list-res.xml.tpl b/nova/tests/integrated/api_samples/os-tenant-networks/networks-list-res.xml.tpl new file mode 100644 index 000000000..0562ebae7 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-tenant-networks/networks-list-res.xml.tpl @@ -0,0 +1,13 @@ + + + + 10.0.0.0/29 + %(id)s + + + + 10.0.0.8/29 + %(id)s + + + diff --git a/nova/tests/integrated/api_samples/os-tenant-networks/networks-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-tenant-networks/networks-post-req.xml.tpl new file mode 100644 index 000000000..0493de387 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-tenant-networks/networks-post-req.xml.tpl @@ -0,0 +1,7 @@ + + + 172.0.0.0/24 + 1 + 1 + 255 + diff --git a/nova/tests/integrated/api_samples/os-tenant-networks/networks-post-res.xml.tpl b/nova/tests/integrated/api_samples/os-tenant-networks/networks-post-res.xml.tpl new file mode 100644 index 000000000..9c6c2f28b --- /dev/null +++ b/nova/tests/integrated/api_samples/os-tenant-networks/networks-post-res.xml.tpl @@ -0,0 +1,5 @@ + + 172.0.0.0/24 + %(id)s + + diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 9b678ddd3..37a8de08a 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -2554,6 +2554,17 @@ class OsNetworksJsonTests(ApiSampleTestBase): self.assertEqual(response.status, 202) +class OsNetworksXmlTests(OsNetworksJsonTests): + ctype = 'xml' + + def test_delete_network(self): + response = self._do_post('os-tenant-networks', "networks-post-req", {}) + net = etree.fromstring(response.read()) + network_id = net.find('id').text + response = self._do_delete('os-tenant-networks/%s' % network_id) + self.assertEqual(response.status, 202) + + class NetworksJsonTests(ApiSampleTestBase): extension_name = ("nova.api.openstack.compute.contrib" ".os_networks.Os_networks") -- cgit