Joe Gordon | 7a2cf01 | 2014-07-18 11:34:39 +0200 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
Matthew Treinish | aeb5274 | 2014-07-25 18:38:56 -0400 | [diff] [blame] | 13 | from tempest import exceptions |
Joe Gordon | 7a2cf01 | 2014-07-18 11:34:39 +0200 | [diff] [blame] | 14 | from tempest.tests import base |
| 15 | |
| 16 | |
| 17 | class TestOutputParser(base.TestCase): |
| 18 | |
| 19 | def test_command_failed_exception(self): |
| 20 | returncode = 1 |
| 21 | cmd = "foo" |
| 22 | stdout = "output" |
| 23 | stderr = "error" |
| 24 | try: |
Matthew Treinish | aeb5274 | 2014-07-25 18:38:56 -0400 | [diff] [blame] | 25 | raise exceptions.CommandFailed(returncode, cmd, stdout, stderr) |
| 26 | except exceptions.CommandFailed as e: |
Joe Gordon | 7a2cf01 | 2014-07-18 11:34:39 +0200 | [diff] [blame] | 27 | self.assertIn(str(returncode), str(e)) |
| 28 | self.assertIn(cmd, str(e)) |
| 29 | self.assertIn(stdout, str(e)) |
| 30 | self.assertIn(stderr, str(e)) |