diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-10-04 21:57:22 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-10-04 21:57:22 +0000 |
| commit | 2a5f567e24d99591d7b60d9766c9cb160cb4bb4c (patch) | |
| tree | 3882f84c193b4a6c30dae444c50fef177284c714 /nova | |
| parent | 5d5260aae6c872c6a7a8ce410a90125902698fb7 (diff) | |
| parent | 103ba151619a2e44b6eff39f99332edc3c4d1dad (diff) | |
| download | nova-2a5f567e24d99591d7b60d9766c9cb160cb4bb4c.tar.gz nova-2a5f567e24d99591d7b60d9766c9cb160cb4bb4c.tar.xz nova-2a5f567e24d99591d7b60d9766c9cb160cb4bb4c.zip | |
Merge "Add api samples to Certificates extension"
Diffstat (limited to 'nova')
7 files changed, 42 insertions, 0 deletions
diff --git a/nova/tests/integrated/api_samples/os-certificates/certificate-create-req.json.tpl b/nova/tests/integrated/api_samples/os-certificates/certificate-create-req.json.tpl new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/nova/tests/integrated/api_samples/os-certificates/certificate-create-req.json.tpl diff --git a/nova/tests/integrated/api_samples/os-certificates/certificate-create-req.xml.tpl b/nova/tests/integrated/api_samples/os-certificates/certificate-create-req.xml.tpl new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/nova/tests/integrated/api_samples/os-certificates/certificate-create-req.xml.tpl diff --git a/nova/tests/integrated/api_samples/os-certificates/certificate-create-resp.json.tpl b/nova/tests/integrated/api_samples/os-certificates/certificate-create-resp.json.tpl new file mode 100644 index 000000000..35c063c82 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-certificates/certificate-create-resp.json.tpl @@ -0,0 +1,6 @@ +{ + "certificate": { + "data": "%(text)s", + "private_key": "%(text)s" + } +} diff --git a/nova/tests/integrated/api_samples/os-certificates/certificate-create-resp.xml.tpl b/nova/tests/integrated/api_samples/os-certificates/certificate-create-resp.xml.tpl new file mode 100644 index 000000000..75f2d5d7f --- /dev/null +++ b/nova/tests/integrated/api_samples/os-certificates/certificate-create-resp.xml.tpl @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<certificate private_key="%(text)s" data="%(text)s"/> diff --git a/nova/tests/integrated/api_samples/os-certificates/certificate-get-root-resp.json.tpl b/nova/tests/integrated/api_samples/os-certificates/certificate-get-root-resp.json.tpl new file mode 100644 index 000000000..4938e92fb --- /dev/null +++ b/nova/tests/integrated/api_samples/os-certificates/certificate-get-root-resp.json.tpl @@ -0,0 +1,6 @@ +{ + "certificate": { + "data": "%(text)s", + "private_key": null + } +} diff --git a/nova/tests/integrated/api_samples/os-certificates/certificate-get-root-resp.xml.tpl b/nova/tests/integrated/api_samples/os-certificates/certificate-get-root-resp.xml.tpl new file mode 100644 index 000000000..bbc54284a --- /dev/null +++ b/nova/tests/integrated/api_samples/os-certificates/certificate-get-root-resp.xml.tpl @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<certificate private_key="None" data="%(text)s"/> diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 4587a2fa1..9aca460cf 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -1145,3 +1145,29 @@ class AggregatesSampleJsonTest(ServersSampleBase): class AggregatesSampleXmlTest(AggregatesSampleJsonTest): ctype = 'xml' + + +class CertificatesSamplesJsonTest(ApiSampleTestBase): + extension_name = ("nova.api.openstack.compute.contrib.certificates." + "Certificates") + + def setUp(self): + super(CertificatesSamplesJsonTest, self).setUp() + + def test_create_certificates(self): + response = self._do_post('os-certificates', + 'certificate-create-req', {}) + self.assertEqual(response.status, 200) + subs = self._get_regexes() + return self._verify_response('certificate-create-resp', subs, response) + + def test_get_root_certificate(self): + response = self._do_get('os-certificates/root') + self.assertEqual(response.status, 200) + subs = self._get_regexes() + return self._verify_response('certificate-get-root-resp', subs, + response) + + +class CertificatesSamplesXmlTest(CertificatesSamplesJsonTest): + ctype = "xml" |
