diff options
| author | Matthew Treinish <treinish@linux.vnet.ibm.com> | 2012-12-14 15:18:22 -0500 |
|---|---|---|
| committer | Matthew Treinish <treinish@linux.vnet.ibm.com> | 2012-12-17 15:50:11 -0500 |
| commit | 2e01dc0673006892e3b559b372a26ff9205d7c81 (patch) | |
| tree | 6884bf157496f34eca031ef4207c960e2411d2b5 | |
| parent | aaae75dc3568ba95d4db5478b1c92eec454356f4 (diff) | |
Fix API samples generation.
In Change: Ie46b24a65145c407d46974b63a97a84911223547 a check
was added to _verify_response() to verify the samples.
However, when trying to generate new samples this blocks
_write_sample() because it attempts to read a non-existent file.
This change ensures that the sample is created before the
verification and still retains the behavior that the samples are
only updated on changes.
Change-Id: I1527ba71676b2e1e10bd334f2a7878404d12600c
| -rw-r--r-- | nova/tests/integrated/test_api_samples.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 8b78d3b51..a59ca1a29 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -227,9 +227,12 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase): def _verify_response(self, name, subs, response): expected = self._read_template(name) expected = self._objectify(expected) - with file(self._get_sample(name)) as sample: - sample_data = sample.read() response_data = response.read() + try: + with file(self._get_sample(name)) as sample: + sample_data = sample.read() + except IOError: + sample_data = "{}" try: response_result = self._verify_something(subs, expected, |
